Page 1 of 1
CGBetterForms enter email address twice for validation
Posted: Sun Nov 25, 2018 1:47 pm
by JamesT
In CGBetterForms I would like the user to enter their email address twice and only submit the form if the two email addresses are identical.
Is this possible?
Re: CGBetterForms enter email address twice for validation
Posted: Sun Nov 25, 2018 2:05 pm
by calguy1000
In your form template create the two email forms. and make them look pretty using CSS etc.
In CGBF, scan the form, then add a 'Validate via Smarty template' handler
in that template.
That template would look something like:
{if $email1 != $email2}Please ensure the email address in both fields match{/if}
Re: CGBetterForms enter email address twice for validation
Posted: Sun Nov 25, 2018 2:17 pm
by JamesT
Perfect, many thanks!
If I may be cheeky, can I repeat an earlier post and ask if there's any way to add a checkbox to the form which allows the person submitting the form to choose whether to get emailed a copy?
Re: CGBetterForms enter email address twice for validation
Posted: Sun Nov 25, 2018 8:20 pm
by calguy1000
1. Add a hidden field to your form , call it something like 'sendtoaddr'
2. Add a 'compute a field value' validation, set the computed field to 'sendtoaddr'
and set the template to something like:
{if $sendmeacopy}{$myemail}{/if}
3. Use the 'Send to User supplied email address' (or whatever it is called) disposition, and specify the 'sendtoaddr' field.
This will be slightly easier in the next version (v1.9) when I release it.
Re: CGBetterForms enter email address twice for validation
Posted: Mon Nov 26, 2018 12:42 am
by JamesT
Great, thanks for your help and work on CGBetterForms, it's maturing nicely.