RadInputManager Scenario problem

2 posts, 0 answers
  1. Dick
    Dick avatar
    36 posts
    Member since:
    Sep 2007

    Posted 13 Apr 2012 Link to this post

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

     

     

     

  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 18 Apr 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top