Forums

Disable submit button after click

WanDal 09 Feb, 2017
Hi

In version 4, I implemented a JS function to disable the submit button once it was clicked in order to prevent double submits. For this, I had the following custom code action in the onload event:
$form->form_params->set('jsvalidation_onValidateSuccess', 'preventMultipleSubmits');

And the following code was placed in a Load JS action:
function preventMultipleSubmits(){
  $('submit_btn').disabled = true;
  $('submit_btn').value = 'Bitte warten...';
};


However, the PHP code is no longer working in version 5. How can I call the JS code once the JS validation was completed successfully?

Many thanks
Daniel
GreyHead 09 Feb, 2017
Answer
Hi Daniel,

Please see this FAQ that shows you how to add a function on validation success in CFv5.

You could also use the Submit Limit action from the Security actions group in the Setup tab - that will block repeated submissions for a specified time period.

Bob
WanDal 09 Feb, 2017
Hi Bob

Great, works as expected! Thank you very much!

Kind regards
Daniel
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger