Add duplicate email confirmation field | OneStepCheckout Help Center

Add duplicate email confirmation field

You can add a duplicate confirmation email field to
app/design/frontend/base/default/template/onestepcheckout/billing_fields.phtml
and use the same validation classes you see on password fields.

Instructions for adding a duplicate email validation field:

(1) Modify file: /js/prototype/validation.js

Add code to line no 567:
['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);
}],

(2) Modify file in your theme folder /template/onestepcheckout/billing_fields.phtml Add 2nd email field:

<div class="input-box input-email'.((in_array('confirm_email',

$formErrors)) ? ' input-error' : '').'">

<label for="billing:confirm_email">'.$this->__('Confirm

email').'

<input type="text" class="input-text required-entry

validate-cemail" value="'.((isset($POST['billing']['confirmemail'])) ? Mage::helper('core')->escapeHtml($POST['billing']['confirmemail']) : '').'" id="billing:confirmemail" title="Confirm Email" name="billing[confirmemail]"/>

</div>';
(3) Test and make sure it works okay.