I have 2 fields in form .

1.user email 
2.confirm email.

If I fill on user email field and moved to confirm email field then enter wrong email i.e; not same as user email, it is showing error "both emails should be same" so in this scenario, it is corect.

other scenario

If I fill on user email field and moved to confirm email field then enter same as user email then edit user name to some other name but it is not showing error message

I need error message on this scenario as well

       title="<?php echo $this->__('User Email') ?>" 
       value="" class="input-text required-entry validate-email"                   type="text" />

       title="<?php echo $this->__('Confirm Email') ?>" 
       class="input-text required-entry validate-cemail" 
       value="" onpaste="return false;" />

1 Answer 1


if you want to use simple jquery you can do something like that

function confirmcheck(){
   var email= $('#useremail').val(); 
   var confirmemail= $('#confirm_email').val();    
      $('.alert').html('<span>email and password are same</span>');

Update: 1

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

For Detail You can see Here

  • @Waquar by default magento not providing? I mean for this class="input-text required-entry validate-email" not possible?
    – User0434
    Commented Dec 9, 2019 at 11:10
  • please see my updated answer
    – Waqar Ali
    Commented Dec 9, 2019 at 11:31
  • it is not working..I placed like this <input type="text" name="confirm_email" id="confirm_email" class="input-text" data-validate="{required:true, 'validate-email':true,equalTo:'#useremail'}" >
    – User0434
    Commented Dec 9, 2019 at 11:42
  • can you check in your "<form" element data-mage-init='{"validation":{}}' is there or not ? Commented Dec 9, 2019 at 12:44

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.