We developed a form with different validation scenario's. By changing dropdowns the form the validators are extended.
This scenario is handled via the javascript OnValidation handler (see example below).
When i change the dropdown ddPaymentType after an error message the eventArgs are set correct.
The summary however keeps showing the old errormessage. The tbAccountHolder TextBox is still marked (red borders) as invalid.
The error message disappears when i enter the TextBox with my cursor.
How do i reset the TextBox, when the validation scenario changes?
Kind regards,
Dick van Straaten
function accountHolderValidation_Validate(sender, eventArgs) {
ResetValidator(sender, eventArgs);
var ddPaymentType = document.getElementById("<%= ddPaymentType.ClientID %>");
var tbAccountHolder = document.getElementById("<%= tbAccountHolder.ClientID %>");
if (ddPaymentType.value == "Collect" && (tbAccountHolder.value == "0123456789" || tbAccountHolder.value == "")) {
eventArgs._isValid = false;
eventArgs._cancel = true;
}
}
RegExpTextBoxSetting accountHolderValidation = CreateRegExpTextBoxSetting(@"(?:[0-9A-Za-z\-\. ]*)", new string[] { "tbAccountHolder" }, false, null);
accountHolderValidation.ClientEvents.OnValidating = "accountHolderValidation_Validate";
radInputManager.InputSettings.Add(accountHolderValidation);