RadButton peforms duplicate requests when:
- A RadButton exists on the page and the form is submitted when a text box is focused and enter key is hit.
- the defaultbutton property of the form is set to the id of the RadButton
For the time being the following functions' override can be used:
<script type="text/javascript">
Telerik.Web.UI.RadButton.prototype._isButtonActiveElement = function (eventTarget) {
var doc = eventTarget && eventTarget.ownerDocument ? eventTarget.ownerDocument : document;
var activeElement = doc.activeElement;
if (!activeElement)
return false;
if (activeElement === this.get_element() || $telerik.$.contains(this.get_element(), activeElement))
return true;
return false;
}
var originalMouseClickHandler = Telerik.Web.UI.RadButton.prototype._mouseClickHandler;
Telerik.Web.UI.RadButton.prototype._mouseClickHandler = function (args) {
if (!this.get_enabled() || this.get_readOnly()) {
$telerik.cancelRawEvent(args.rawEvent);
return false;
}
var eventTarget = args.target ? args.target : args.srcElement;
if (eventTarget === this.get_element() && !this._isButtonActiveElement(eventTarget) && !$telerik.isTouchDevice) {
$telerik.cancelRawEvent(args.rawEvent);
this.focus();
return false;
}
originalMouseClickHandler.call(this, args);
}
</script>
The workaround must be placed after the declaration of the RadButton, in order to take effect.