Question

I need to change the email validation of Magento's Checkout page (Checkout as a Guest).

The problem is the default style of input box contains character support only. When I tried to input email with numbers, it doesn't accept and display number.

So I need a proper validation with regard to its email. The email address input box should also accept characters with numbers.

Thanks,

I tried to check this Code:

File location: onepage/billing.phtml

 <?php if(!$this->isCustomerLoggedIn()): ?>
                    <div class="field">
                        <label for="billing:email" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text validate-email required-entry" />
                        </div>
                    </div>
        <?php endif; ?>

File location: validation.js

['validate-email', 'Please enter a valid email address. For example johndoe@domain.com.', function (v) {
                //return Validation.get('IsEmpty').test(v) || /\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/.test(v)
                //return Validation.get('IsEmpty').test(v) || /^[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9][\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9\.]{1,30}[\!\#$%\*/?|\^\{\}`~&\'\+\-=_a-z0-9]@([a-z0-9_-]{1,30}\.){1,5}[a-z]{2,4}$/i.test(v)
                return Validation.get('IsEmpty').test(v) || /^([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9,!\#\$%&'\*\+\/=\?\^_`\{\|\}~-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*@([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z0-9-]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*\.(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]){2,})$/i.test(v)
            }],
Was it helpful?

Solution

I found the solution. File Location: template/webtexgiftregisrty/billing.phtml

On th field box of email address, insert the string data types inside the class validation.

Here's the code:

<input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->htmlEscape($this->getAddress()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="string input-block-level input-text validate-email required-entry billing-email" />
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top