We should add an option to the Submit buttons in
htmlobject::form that runs js code to disable the
button after clicking. this would prevent double
submissions (mostly).
It would be great if it could be added to regular
buttons also.
The code I'm using in the DB::Upgrade module is
onclick="javascriptFunction(); this.disabled = true;"
Notice that I am doing some other stuff during onclick.
so our api would need to add the disabled code to
whatever the user specifies.
submit => {
-Type => "submit",
-Label => "Click Me",
-ClickLabel => "Please Wait",
onclick => "javascriptFunction();"
-ClickDisable => 1,
# defaults to 1 for submit buttons and 0 for regular
buttons.
We also want to allow the user to specify different
text for the submit button after it has been clicked.
Logged In: YES
user_id=236631
The -clickDisables option defaults to true (=> 1) for a
submit button so that the user cannot click on the submit
button twice. After the user clicks the button javascript
code will be run that sets this.disabled = true; This
javascript will be added to the onclick hanlder in addition
to any other code specified for onclick. To turn it off
specify -clickDisables => 0. After the click the label can
be changed by setting -clickLabel => 'some text'. If the
option is not set the label remains unchanged.