Single Click Button with RequiredFieldValidators

3 posts, 0 answers
  1. Mike
    Mike avatar
    25 posts
    Member since:
    Aug 2010

    Posted 30 Aug 2011 Link to this post


    I'm using single click buttons.  What do I need to do for the client-side validators to fire before the button gets disabled?  The problem I'm having is my button is becoming disabled in the OnClientClicked, but my asp:RequiredFieldValidators are preventing the form from being submitted.  I only want the single click feature to kick in if all the client-side validation passes.

  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 31 Aug 2011 Link to this post

    Hello Mike,

    Here is the logic I use for my single-click buttons, which takes validation into consideration (when it exists):

    function btnSingleClick_OnClientClicked(sender, args) {
        try {
            // determine if page is valid
            var pageIsValid;
            try {
                // get value from Page_IsValid
                // NOTE: Contained this assignment in try block in case Page_IsValid doesn't exist
                pageIsValid = Page_IsValid;
            } catch (e) { }
            // make sure page is valid or validation is null (doesn't exist)
            if (pageIsValid || pageIsValid == null) {
                // disable control
        } catch (e) {

    I hope that helps.
  3. Slav
    Slav avatar
    1359 posts

    Posted 31 Aug 2011 Link to this post

    Hello Kevin,
    In such scenarios you should ensure that the page validation is executed before the custom client-side scripts. This can be achieved by validating the aspx page on the client via the Page_ClientValidate method. Please check this help article in order to learn more on the matter: RadButton Validation And Client-Side Event Handlers.

    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top