Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ENHANCEMENT Added form.clickedButton to all forms triggered inside Le…

…ftAndMain javascript

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92770 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
commit 4c7132299734297bada063da0d22a0cba998d6a7 1 parent 650d44d
@chillu chillu authored
Showing with 11 additions and 0 deletions.
  1. +11 −0 javascript/LeftAndMain.js
View
11 javascript/LeftAndMain.js
@@ -195,6 +195,9 @@ var ss_MainLayout;
/**
* @class Make all buttons "hoverable" with jQuery theming.
+ * Also sets the clicked button on a form submission, making it available through
+ * a new 'clickedButton' property on the form DOM element.
+ *
* @name ss.LeftAndMain.Buttons
*/
$('.LeftAndMain :submit, .LeftAndMain button, .LeftAndMain :reset').concrete('ss', function($){
@@ -217,6 +220,14 @@ var ss_MainLayout;
})
.blur(function() {
$(this).removeClass('ui-state-focus');
+ })
+ .click(function() {
+ var form = this.form;
+ // forms don't natively store the button they've been triggered with
+ form.clickedButton = this;
+ // Reset the clicked button shortly after the onsubmit handlers
+ // have fired on the form
+ setTimeout(function() {form.clickedButton = null;}, 10);
});
this._super();
Please sign in to comment.
Something went wrong with that request. Please try again.