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

Un setting single click in JS

1 Answer 83 Views
Button
This is a migrated thread and some comments may be shown as answers.
David Rhodes
Top achievements
Rank 1
David Rhodes asked on 10 May 2013, 02:50 PM
I have a function to handle validation on my single click radbutton, how do I toggle the state of the single click in JS, currently the button remains with it's SingleClickText if the script below doesn't validate

<script type="text/javascript">
            function DoSubscriptionValidation(button, args) {
                var isValid = Page_ClientValidate('Subscription');
                if (isValid) {
                    $find("<%= SubscriptionErrorNotification.ClientID %>").hide();
                }
                else {
                    $find("<%= SubscriptionErrorNotification.ClientID %>").show();
                }
                button.set_autoPostBack(isValid);
            }
        </script>

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 15 May 2013, 11:49 AM
Hi,

This seems to be an issue with the RadButton when the following conditions are met:
  • SingleClick property of RadButton is enabled
  • AutoPostBack property of RadButtons is disabled either in the markup or on the client in the OnClientClicking event.

I have logged the unexpected behavior as a feedback item here, so that you can monitor, comment or raise it priority by voting on it.

For the time being, instead of performing a validation in the OnClientClicking event, you can simply put the RadButton, the validation controls and the controls which are to be validated in a common validation group. For example:

<telerik:RadButton ID="RadButton1" runat="server" Text="Click" SingleClick="true"
    ValidationGroup="vg1" AutoPostBack="true" OnClick="OnClick1" OnClientClicking="DoSubscriptionValidation"
    SingleClickText="Please Wait" />
<asp:TextBox ID="Textbox1" runat="server" ValidationGroup="vg1" />
<asp:RequiredFieldValidator ID="rfv1" runat="server" ControlToValidate="Textbox1"
    ValidationGroup="vg1"></asp:RequiredFieldValidator>

As small token of gratitude for reporting this issue I have updated your Telerik points.
Regards,
Danail Vasilev
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
Button
Asked by
David Rhodes
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or