- type:
- snippet
- category:
- checkout
- name:
- Adding an email confirmation field to the checkout
- reference:
- http://forum.foxycart.com/comments.php?DiscussionID=190&page=1
- date:
- 2011-05-27
Adding an email confirmation field to the checkout
See the code below:
<script type="text/javascript" charset="utf-8"> jQuery(document).ready(function() { var verifyEmail = '<li id="li_customer_email_verify" class="fc_row fc_customer_email_verify">'; verifyEmail += '<label class="fc_label_left" for="customer_email_verify">Retype Email<span class="fc_ast">*</span></label>'; verifyEmail += '<input type="text" value="" autocomplete="off" class="fc_text fc_text_long fc_required" id="customer_email_verify" name="customer_email_verify"/>'; verifyEmail += '<label style="display: none;" class="fc_error" id="customer_email_verify_error" for="customer_email_verify">Please verify your email address.</label>'; verifyEmail += '</li>'; jQuery(verifyEmail).insertAfter('#li_customer_email'); // Now add the onblur error checking events jQuery("#customer_email_verify").blur(function() { if (this.value == "") { FC.checkout.updateErrorDisplay(this.name,true); } else if (this.value != "" && this.value != jQuery('#customer_email').val()) { jQuery('label[for="customer_email_verify"].fc_error').text("Email address does not match."); FC.checkout.updateErrorDisplay(this.name,true); } else { FC.checkout.updateErrorDisplay(this.name,false); } }); jQuery("#customer_email").blur(function() { if (this.value != "" && this.value == jQuery('#customer_email_verify').val()) { FC.checkout.updateErrorDisplay(jQuery('#customer_email_verify').attr('name'),false); } else if (this.value != "" && this.value != jQuery('#customer_email_verify').val()) { FC.checkout.updateErrorDisplay(jQuery('#customer_email_verify').attr('name'),true); } }); }); </script>