Confirm email element

To add a confirmation email field, create a new form element in the HTML by copying the HTML in the box below and paste it into your form.

1
2
3
4
5
6
7
8
9
10
<!-- Begin Text input element - Email confirm -->
<div class="quform-element quform-element-text">
    <div class="quform-spacer">
        <label for="email_confirm">Confirm Email <span class="quform-required">*</span></label>
        <div class="quform-input">
            <input id="email_confirm" type="text" name="email_confirm" />
        </div>
    </div>
</div>
<!-- End Text input element - Email confirm -->
<!-- Begin Text input element - Email confirm -->
<div class="quform-element quform-element-text">
    <div class="quform-spacer">
        <label for="email_confirm">Confirm Email <span class="quform-required">*</span></label>
        <div class="quform-input">
            <input id="email_confirm" type="text" name="email_confirm" />
        </div>
    </div>
</div>
<!-- End Text input element - Email confirm -->

Add the following code to your process.php file, at the element configuration section.

1
2
3
4
5
6
7
$emailConfirm = new Quform_Element('email_confirm', 'Confirm email address');
$emailConfirm->addValidator('required');
$emailConfirm->addValidator('emailConfirm', array(
    'messages' => array('not_match' => 'The email addresses do not match')
));
$emailConfirm->setIsHidden(true);
$form->addElement($emailConfirm);
$emailConfirm = new Quform_Element('email_confirm', 'Confirm email address');
$emailConfirm->addValidator('required');
$emailConfirm->addValidator('emailConfirm', array(
    'messages' => array('not_match' => 'The email addresses do not match')
));
$emailConfirm->setIsHidden(true);
$form->addElement($emailConfirm);

If you’d like, you can change the error message by changing the text ‘The email addresses do not match’.

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy