I have a form set up where the user fills out registration information, then a confirmation page is displayed with previously entered data and an agreement (this is done using the built-in confirmation plugin).
I would like to require the user to check a checkbox to agree to the agreement before they can click the submit button. Is this possible? Is there a way to return an error to the confirmation page if the checkbox isn't checked and the user presses the submit button?
Thanks in advance.
I would like to require the user to check a checkbox to agree to the agreement before they can click the submit button. Is this possible? Is there a way to return an error to the confirmation page if the checkbox isn't checked and the user presses the submit button?
Thanks in advance.
Hi rockhard,
Yes, you can do this with JavaScript (I usually disable the submit button until the box is checked) or you can use ServerSide validation (or both).
Bob
Yes, you can do this with JavaScript (I usually disable the submit button until the box is checked) or you can use ServerSide validation (or both).
Bob
Hi Bob,
Isn't the serverside-verification done before the onsubmit plugin-event is fired? Since the Agree input wouldn't be available until the confirmation page is shown, that'd block the whole form.
I'd consider using the "On Submit - Before email" entry and set the $MyForm->stoprunning property to stop further processing in the case of no "Agree'd".
/Fredrik
Isn't the serverside-verification done before the onsubmit plugin-event is fired? Since the Agree input wouldn't be available until the confirmation page is shown, that'd block the whole form.
I'd consider using the "On Submit - Before email" entry and set the $MyForm->stoprunning property to stop further processing in the case of no "Agree'd".
/Fredrik
Hi both,
Fredrik, yes it is, I didn't read the post thoroughly enough :-(
Bob
Fredrik, yes it is, I didn't read the post thoroughly enough :-(
Bob
Thank you both for the prompt reply.
I went with Fredrik's method and had some success. Setting
How can I display an error message letting the user know they didn't check the box? How can I stop the form email from being sent if the box hasn't been checked?
Thanks again for your help.
I am beginning to think I need to use a multipage form instead of the confirmation plugin? I am hoping that there's a way to do this with the confirmation plugin
I went with Fredrik's method and had some success. Setting
$MyForm->stoprunning=true; if 'i agree' isn't checked stops the form from creating a user (I am also using the CB Plugin) but the form emails are still sent out and the user is directed to a blank page.How can I display an error message letting the user know they didn't check the box? How can I stop the form email from being sent if the box hasn't been checked?
Thanks again for your help.
I am beginning to think I need to use a multipage form instead of the confirmation plugin? I am hoping that there's a way to do this with the confirmation plugin
You might be able to post an error message using $MyForm->formerrors. That should trigger a re-display of the form (unfortunately not the confirmation-page), along with the error message.
Also, did you use the on submit - before email or on submit - after email box? Further, what is your "run-order" of your form?
In essence, we need to run our check of the "I accept" checkbox before any plugins are executed.
/Fredrik
Also, did you use the on submit - before email or on submit - after email box? Further, what is your "run-order" of your form?
In essence, we need to run our check of the "I accept" checkbox before any plugins are executed.
/Fredrik
This worked for me, thank you. For others, my run order is
1. autogenerated code
2. onsubmit block
3. plugins
I used the onsubmit before email block to enter my error checking for the checkbox. The code to display the error is as follows (the value of my checkbox (cbox) is equal to I agree).
The error displays not on the confirmation page but on the actual form itself, which in my situation will work, but is not ideal.
Thanks for all the help!
1. autogenerated code
2. onsubmit block
3. plugins
I used the onsubmit before email block to enter my error checking for the checkbox. The code to display the error is as follows (the value of my checkbox (cbox) is equal to I agree).
$cbox = utf8_decode($_POST['cbox']);
if($cbox != "I Agree"){
$MyForm->stoprunning = true;
$MyForm->formerrors = $error1;
}The error displays not on the confirmation page but on the actual form itself, which in my situation will work, but is not ideal.
Thanks for all the help!
This topic is locked and no more replies can be posted.
