Prevent Multiple Form Submissions


(M L Sanders) #1

Matrix Version:5.3.3.0

I need to retro-fit some javascript to a Squiz Form to prevent multiple form submission.

The problem is that all the obvious stuff I try - disabling the submit button when it’s clicked, or when the form’s submitted - prevents the Squiz form from working at all.

Really I’d like to know: has anyone succesfully achieved this, and if so what approach (squiz form settings etc, as well as the javascript approach) did they use?

many thanks
mark


(M L Sanders) #2

I have discovered the following:

  • Any attempt to disable the ‘submit’ button prevents Squiz from displaying error text
  • If I instead set the submit button to ‘display:none’ on form submission, error text is displayed without problem, the button comes back into view when the page refreshes and a valid form submission will occur.

So there’s a workaround, but it feels really really horrible.
Not going to implement this til next week, so if anyone has any comments…

mark


(Bart Banda) #3

You could try setting a submission time limit on the details screen of the form contents asset?

Alternatively, it should be easy to do with JS where you add an onSubmit event handler that sets a variable for something like var submitted = true, then on the submit handler you also check if that value is true, if it is, show message saying that the form has already been submitted, please wait…


(Paul Duffield) #4

Has anybody been able to add an error message to the last page of their multi page custom form, that tells users if they have already submitted their form. As I understand it, Matrix will not allow a form to be resubmitted, yet, there is no feedback to the client when this situation occurs. The only clue is that the form does not submit. Is there a keyword for this?


(Bart Banda) #5

No simple keyword for this unfortunately, but you could always do something with JS perhaps?


(Paul Duffield) #6

Thank Bart,

Cheers
Paul.