Created
December 11, 2013 14:46
-
-
Save speedupmate/7911608 to your computer and use it in GitHub Desktop.
Create e-mail matching validation field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if(!$this->isCustomerLoggedIn()): ?> | |
<?php $billingFields['email'] = $billingFields['email'].' | |
<div class="input-box input-email'.((in_array('email', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:email">'.$this->__('Email Address').' <span class="required">*</span></label><br /> | |
<input type="text" name="billing[email]" id="billing:email" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getEmail()).'" title="'.$this->__('Email Address') .'" class="validate-email required-entry input-text" /> | |
</div> | |
<div class="input-box input-email-repeat'.((in_array('email', $formErrors)) ? ' input-error' : '').'"> | |
<label for="billing:email-repeat">'.$this->__('Retype Email Address').' <span class="required">*</span></label><br /> | |
<input type="text" name="billing[email-repeat]" id="billing:email-repeat" value="'.$dataHelper->clearDash($this->getQuote()->getBillingAddress()->getEmail()).'" title="'.$this->__('Repeat Email Address') .'" class="validate-cemail required-entry input-text" /> | |
</div> | |
<script> | |
Validation.add("validate-cemail", "'.$this->__('Please make sure that you have typed a matching e-mail address').'", function(v) { | |
var vemail = $("billing:email").getValue(); | |
var vcemail = $("billing:email-repeat").getValue(); | |
return (vemail == vcemail); | |
}); | |
</script>'; | |
?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment