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

In Q1 2013 Server-side OnClick event and Client-side validation are not performed when ValidationGroup is set

0 Answers 403 Views
Button
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Telerik Admin
Top achievements
Rank 1
Iron
Telerik Admin asked on 26 Feb 2013, 08:11 AM
These issues are fixed in Q1 2013 SP1.

In Q1 2013 the Server-side OnClick event handler is not called and Client-side validation is not performed when ValidationGroup is set for a RadButton. The scenarios are as follows:

  • The Server-side OnClick event is not triggered by a RadButton when it is used on a master page and the button's ValidationGroup property is set. This behaviour is observed under Internet Explorer, Chrome and Safari, but not in FireFox and Opera. If, however, the RadAjaxManager is used in the master page the issue is observed in all browsers. (Link to feedback portal)
  • Client-side ASP.NET validation is not executed when it is initiated by a RadButton and its ValidationGroup property is set. The unexpected behaviour is observed under FireFox and Opera. (Link to feedback portal).

These issues have already been fixed in the 2013.1.227 internal build and the fixes will also be present in the upcoming Q1 2013 SP1. The internal build can be used for development and it can be downloaded from this page. For the time being the following workaround can be used in both scenarios.

This is a common setup that will cause the problems described above:

<asp:TextBox runat="server" ID="TextBox1" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
    ValidationGroup="TextBoxValidation" Text="*" />
<telerik:RadButton runat="server" ID="RadButton1" ValidationGroup="TextBoxValidation"
    Text="Submit" />

This function override should be placed at the end of the page to fix the issues:
<script type="text/javascript">
    Telerik.Web.UI.RadButton.prototype._buildPostBackOptions = function() {             
        var options = this._getPostBackOptions() || {
            eventTarget: this.get_uniqueID(),
            eventArgument: this.get_enableSplitButton() ? 'RadButtonEventArguments': '',
            validation: this._validationGroup ? true: false,
            validationGroup: this._validationGroup,
            actionUrl: this._navigateUrl || '',
            trackFocus: false,
            clientSubmit: !this.IsInputTypeSubmit() || this.get_singleClick() || this.get_buttonType() != Telerik.Web.UI.RadButtonType.StandardButton || this.IsImageButton(),
        };                   
        return "new WebForm_PostBackOptions('" + options.eventTarget + "', '"
            + options.eventArgument + "', "
            + options.validation + ", '"
            + options.validationGroup + "', '"
            + options.actionUrl + "', "
            + options.trackFocus + ", "
            + options.clientSubmit + ")";
    }
</script>
Tags
Button
Asked by
Telerik Admin
Top achievements
Rank 1
Iron
Share this question
or