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

SingleClick and validation

4 Answers 64 Views
Button
This is a migrated thread and some comments may be shown as answers.
moegal
Top achievements
Rank 1
moegal asked on 04 Dec 2012, 10:12 PM
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



4 Answers, 1 is accepted

Sort by
0
Accepted
Kevin
Top achievements
Rank 2
answered on 07 Dec 2012, 01:13 PM
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.
0
moegal
Top achievements
Rank 1
answered on 07 Dec 2012, 01:48 PM
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

0
miksh
Top achievements
Rank 1
Iron
answered on 24 Jun 2014, 06:00 PM
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?
0
Dobromir
Telerik team
answered on 27 Jun 2014, 08:30 AM
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.

 
Tags
Button
Asked by
moegal
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
moegal
Top achievements
Rank 1
miksh
Top achievements
Rank 1
Iron
Dobromir
Telerik team
Share this question
or