SingleClick and validation

5 posts, 1 answers
  1. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 04 Dec 2012 Link to this post

    I have a form with a RadButton set to use the new SingleClick and a RadDatePicker with a RequiredFieldValidator.

    The button stays depressed after clicking if the  RadDatePicker is empty.

    Any ideas?

    Marty



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

    Posted 07 Dec 2012 Link to this post

    Hey moegal,

    You can handle the OnClientClicking event of the RadButton and check if validation passed or not. If it doesn't you cancel the click, thus preventing the single click functionality from kicking in.

    Javascript:
    function OnClientClicking(sender, args) {
                // make sure page is valid
                if (!Page_IsValid) {
                    args.set_cancel(true);
                }
            }


    I hope that helps.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. moegal
    moegal avatar
    273 posts
    Member since:
    Jul 2007

    Posted 07 Dec 2012 Link to this post

    Kevin,

    Thanks. That works!

    I had already tried it but I did so incorrectly (I was using the wrong event handler. "OnClientCheckedChanging" for the type of button)

    Marty

  5. miksh
    miksh avatar
    275 posts
    Member since:
    Nov 2006

    Posted 24 Jun 2014 in reply to Kevin Link to this post

    A client-side validation is pretty common scenario, and telerik:Button should be smart enough not to disable itself if no postback/callback occurred. Would it be reasonable to add your workaround into Button logic?
  6. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 27 Jun 2014 Link to this post

    Hi Michael,

    This scenario is handled by RadButton, however there is a bug in the last version of Telerik UI for ASP.NET - http://feedback.telerik.com/Project/108/Feedback/Details/131636-fix-button-single-click-gets-disabled-permanently-if-required-field-validator-er

    The problem is already handled and the fix will be available in the upcoming service pack.

    Regards,
    Dobromir
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017