Adding Confirm E-mail Address Field to Magento Frontend any forms

Add following code into validate.js after "validate-admin-password"
path: your magento directory/js/prototype/validate.js

['validate-cemail', 'Please make sure your emails match.', function(v) {
        var conf = $$('.validate-cemail')[0];
        var pass = false;
        if ($('email')) {
        pass = $('email');
        }
        var emailElements = $$('.validate-email');
        for (var i = 0; i < emailElements.size(); i++) {
        var emailElement = emailElements[i];
        if (emailElement.up('form').id == conf.up('form').id) {
        pass = emailElement;
        }
        }
        if ($$('.validate-admin-email').size()) {
        pass = $$('.validate-admin-email')[0];
        }
        return (pass.value == conf.value);
        }],
       

after editing validate.js please open phtml file where you want to add confirm email input

for example you want to add it into billing.phtml and add following code into it


<div class="field">
                        <label for="billing:confirm_email" class="required"><em>*</em><?php echo $this->__('Confirm Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" name="billing[confirm_email]" title="<?php echo $this->__('Confirm Email') ?>" id="billing:confirm_email" class="input-text required-entry validate-cemail" />
                        </div>
                    </div>   

now Refresh your page


Thanks
Abhay

Comments