This is a migrated thread and some comments may be shown as answers.

RadInputManager Scenario problem

1 Answer 35 Views
Input
This is a migrated thread and some comments may be shown as answers.
Dick
Top achievements
Rank 1
Dick asked on 13 Apr 2012, 03:38 PM

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);

 

 

 

1 Answer, 1 is accepted

Sort by
0
Vasil
Telerik team
answered on 18 Apr 2012, 09:13 AM
Hello Dick van Straaten,

The state of the inputs managed by the manager will be updated on focus. And if you change the validation requirements and the inputs are actually passing them, you could just focus and blur the inputs and their state will be reset. So get the inputs on the page and use focus() and blur() JavaScript functions over them.

Regards,
Vasil
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Input
Asked by
Dick
Top achievements
Rank 1
Answers by
Vasil
Telerik team
Share this question
or