I need to create a custom function to validate the format of a textbox value, which should be in 'MMM YYYY' format (e.g.: Dec 2014).
I am utilizing the AjaxControlToolkit and noticed that the maskededitvalidator has a property called ClientValidatonFunction, similar to CustomValidator.
However, I am facing an issue where this function doesn't seem to be triggered at all.
Below is my JavaScript function:
<script type="text/javascript">
function MyFunction(sender, args) {
alert("foo");
}
</script>
Here is my ASP code:
<asp:textbox id="StartTextBox" cssclass="textbox"
style="width: 60px;" validationgroup="Dialog"
causesvalidation="false" runat="server">
</asp:textbox>
<ajaxtoolkit:calendarextender id="StartCalendarExtender"
targetcontrolid="StartTextBox" format="MMM yyyy"
OnClientHidden="onCalendarHidden_StartTextBox"
OnClientShown="onCalendarShown_StartTextBox"
BehaviorID="calendar_StartTextBox" runat="server">
</ajaxtoolkit:calendarextender>
<ajaxtoolkit:maskededitextender id="StartMaskedEditExtender"
targetcontrolid="StartTextBox" enabled="false"
mask="??? 9999" masktype="Date" oninvalidcssclass="textbox_invalid"
runat="server">
</ajaxtoolkit:maskededitextender>
<ajaxtoolkit:maskededitvalidator id="StartMaskedEditValidator"
controlextender="StartMaskedEditExtender" display="Dynamic"
controltovalidate="StartTextBox"
clientvalidationfunction="MyClientFunction" enableclientscript="true"
enabled="true" isvalidempty="false" runat="server">
</ajaxtoolkit:maskededitvalidator>
The alert message never appears on screen.
I'm wondering what mistake I might be making or what changes are needed to ensure the clientvalidationfunction is executed as expected.
AoE