I've created a module which adds an additional field to the checkout, called 'email-confirm'. I want to check that the value in this field is equal to the first email entry, but I'm unsure how to do this.

1 Answer 1


The registration form is worth having a look over it uses the following:

data-validate="{required:true, equalTo:'#password'}"

So based on that, if you have a template you should add a specific validator for equalTo and the target which you wish to compare it to.

If your using it through xml to build your form similar to the checkout I expect that you can add it as an item eg:

<item name="validation" xsi:type="array">
    <item name="equalTo" xsi:type="string">#target</item>

The above I've not verified however but believe that way should work.

  • Thanks for you response, I've just tried this method and while it seems to be valid xml it doesn't seem to apply the validation. I've replaced the #target with #customer-email and but when I submit the form without filling this in - it succeeds rather than prevents you from submitting (as it should). Commented Nov 11, 2016 at 16:48
  • This didn't work due to another issue in my xml, works now - thanks. Commented Dec 1, 2016 at 13:05
  • I'm trying to get this to work using a overwrite on the password.html but i keep getting the error: 'msg.replace', any idea?
    – Sanne
    Commented Jun 27, 2018 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.