Skip to main content
edited body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Magento uses Prototype library to manage form validation of input fields. This comes in handy, because all you need to do when writing custom form is to assign a valid class names to your input fields, and pass the form id to VarienForm object.

you need add css class validate-phoneStrict at field which will do thisthis type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js

        <input type="tel" name="billing[telephone]" 
    value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>"
     title="<?php echo $this->__('Telephone') ?>" class="validate-phoneStrict
     input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>"
 id="billing:telephone" />

and you can also do below format:

(123) 456-7890 or 123-456-7890

Magento uses Prototype library to manage form validation of input fields. This comes in handy, because all you need to do when writing custom form is to assign a valid class names to your input fields, and pass the form id to VarienForm object.

you need add css class validate-phoneStrict at field which will do this type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js

        <input type="tel" name="billing[telephone]" 
    value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>"
     title="<?php echo $this->__('Telephone') ?>" class="validate-phoneStrict
     input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>"
 id="billing:telephone" />

and you can also do below format:

(123) 456-7890 or 123-456-7890

Magento uses Prototype library to manage form validation of input fields. This comes in handy, because all you need to do when writing custom form is to assign a valid class names to your input fields, and pass the form id to VarienForm object.

you need add css class validate-phoneStrict at field which will do this type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js

        <input type="tel" name="billing[telephone]" 
    value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>"
     title="<?php echo $this->__('Telephone') ?>" class="validate-phoneStrict
     input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>"
 id="billing:telephone" />

and you can also do below format:

(123) 456-7890 or 123-456-7890
added 707 characters in body
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

Magento uses Prototype library to manage form validation of input fields. This comes in handy, because all you need to do when writing custom form is to assign a valid class names to your input fields, and pass the form id to VarienForm object.

you need add css class validate-phoneStrict at field which will do this type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js

        <input type="tel" name="billing[telephone]" 
    value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>"
     title="<?php echo $this->__('Telephone') ?>" class="validate-phoneStrict
     input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>"
 id="billing:telephone" />

and you can also do below format:

(123) 456-7890 or 123-456-7890

you need add css class validate-phoneStrict at field which will do this type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js

Magento uses Prototype library to manage form validation of input fields. This comes in handy, because all you need to do when writing custom form is to assign a valid class names to your input fields, and pass the form id to VarienForm object.

you need add css class validate-phoneStrict at field which will do this type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js

        <input type="tel" name="billing[telephone]" 
    value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>"
     title="<?php echo $this->__('Telephone') ?>" class="validate-phoneStrict
     input-text <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>"
 id="billing:telephone" />

and you can also do below format:

(123) 456-7890 or 123-456-7890
Source Link
Amit Bera
  • 77.7k
  • 20
  • 124
  • 239

you need add css class validate-phoneStrict at field which will do this type validation. you need to remove validate-number etc validation

You need see js field validation at js\prototype\validation.js