Rank: Member Groups: Member
Joined: 9/6/2011 Posts: 26
|
I have a masked field for the phone number inside the grid:
<eo:MaskedEditColumn DataField="CellPhone" Width="120" HeaderText="Cell Phone" ClientSideEndEdit="validatePhone"> <MaskedEdit runat="server" Width="120" ControlSkinID="None"> <eo:MaskedEditSegment SegmentType="Number" MaxValue="1" MinValue="1" /> <eo:MaskedEditSegment SegmentType="Literal" Text="-" /> <eo:MaskedEditSegment SegmentType="Mask" Mask="000" /> <eo:MaskedEditSegment SegmentType="Literal" Text="-" /> <eo:MaskedEditSegment SegmentType="Mask" Mask="000" /> <eo:MaskedEditSegment SegmentType="Literal" Text="-" /> <eo:MaskedEditSegment SegmentType="Mask" Mask="0000" /> </MaskedEdit> </eo:MaskedEditColumn>
I need to validate that the user enters the entire number, so I call ClientSideEndEdit="validatePhone"
function validatePhone(cell) { var cellValue = cell.getValue(); var error = ""; var stripped = cellValue.replace(/[\(\)\.\-\ ]/g, '');
if (cellValue == "") { error = "You didn't enter a phone number.\n"; } else if (isNaN(parseInt(stripped))) { error = "The phone number contains illegal characters.\n"; } else if (!(stripped.length == 11)) { error = "The phone number is the wrong length. Make sure you included an area code.\n"; } window.alert(error); return false;
}
However on the function the cell value is undefined and the function failed
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,195
|
Hi, Please see here for how to use this event handler: http://www.essentialobjects.com/doc/1/jsdoc.public.handlers.grid_column_endedit.aspxThis event handler is called BEFORE the new value is accepted by the Grid. Thanks
|