Welcome Guest Search | Active Topics | Sign In | Register

Validating MaskedEditColumn In Grid Options
MannyRosa
Posted: Thursday, October 18, 2012 7:14:35 AM
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
eo_support
Posted: Sunday, October 21, 2012 1:12:53 PM
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.aspx

This event handler is called BEFORE the new value is accepted by the Grid.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.