Thread tagged as: Problem, Addons, Forms

Validate two email fields for same value

is it possible to validate two email fields for the same value out of the box? This is a request from a client. Any suggestions as to an approach for this greatly appreciated. Thank you.

Matthew Owen

Matthew Owen 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, you can use the match-with attribute.

<perch:input id="email2" match-with="email1" ... />
Drew McLellan

Drew McLellan 2638 points
Perch Support

Here's an example from the docs with two password fields:

        <perch:label for="password">Password</perch:label>
        <perch:input type="password" id="password" required="true" match-with="password2" />
        <perch:error for="password" type="required">Please add a password</perch:error>
        <perch:error for="password" type="match">Passwords do not match</perch:error>

        <perch:label for="password2">Password again</perch:label>
        <perch:input type="password" id="password2" required="true" />
        <perch:error for="password2" type="required">Please repeat your password</perch:error>

Awesome Drew, thank you shall try it out right now :-)

Sorry to resurrect an old thread but I've run into an odd situation with this feature.

My form has two email fields -- "email" and "email_verify" -- and I used the "match-with" attribute as you indicated above to connect "email_verify" to the "email" field. On the front-end, things seemed to work fine, I got the appropriate feedback, etc.

However, when I checked the form submission data in the admin area, I only saw the "email_verify" field. Is this by design, since if the email fields match, they have the same value anyway?

FWIW, the site is running a pretty old version -- v2.2.11 -- so is this something fixed in a later update? (I tried searching the changelog, but didn't find anything there.)

Rachel Andrew

Rachel Andrew 394 points
Perch Support


please raise your own thread if you still have the issue after updating Perch. We can't offer support for such an outdated version.

If you still have the problem on the latest version we need your template code and Diagnostics Report with each post to the forum.