Form submission fails
Clicking "submit", doesn't, with amusing special effects.
Symptoms
A custom product I'd written has a lot of extra forms, largely on custom content tabs. "Suddenly" (i.e. it probably hasn't worked for a while, but I hadn't noticed), those forms wouldn't submit. Instead the page stayed where it was, the button elongated and the button face became an editable text field (!). When the button text was being edited, if return was hit, the page was submitted. Some forms I had elsewhere on the site, for example as a site preferences configlet, did not display this behaviour. Form layout, classes and parameters were roughly the same for all cases.
Technical details
Plone 3.1.2 created from a unified installer, running on MacOS 10.5.3, viewed with Safari.
Diagnosis
In newer versions of Plone (3.x on, I think) the content editor has a handy feature to prevent accidental resubmission of the form. If a form "submit" button is clicked twice, a dialog pops up and asks:
You already clicked the submit button. Do you really want to submit this form again?
This is the same functionality that warns you if you leave a form after having filled in some values. Although the warning message can be found in plone_javascript_variables.js.pt, the responsible agent is a javascript formsubmithelpers.js that intercepts all submit buttons in the content area and changes their class depending on submission state. (Hence the strange visual effects.)
Solution
The only reference to this problem on the web can be found on a French webpage, which you can get a servicable Google translation.
Essentially, it involves customising the help script so it avoids handling submit buttons with a "nocheck" class, and adding this to your forms. So the form contains this:
<input class="context nocheck" type="submit" ... />
and formsubmithelpers.js looks like this:
function inputSubmitOnClick(event){
if(!event) var event=window.event;
if (! hasClassName(this,'nocheck'))
if (hasClassName(this,'submitting')){
return confirm(window.form_resubmit_message)
}
else {
addClassName(this,'submitting');
}
return true
}
Getting it to take may require putting Javascript into debug mode or zapping the caches. It would be useful if Plone modified the submit helpers so it tested for an opt-out, or even better an explicit opt-in.
