In billing.phtml
file Zip/Postal Code validation is not working properly.
1) When I field is empty it's asking it's required fine.
2) But letter's also allowing this field. I don't want to allow letters only Numeric values will allow.
my code is
<div class="field">
<label for="billing:postcode" class="required"><em>*</em><?php echo $this->__('Zip/Postal Code') ?></label>
<div class="input-box">
<input type="text" title="<?php echo $this->__('Zip/Postal Code') ?>" name="billing[postcode]" id="billing:postcode" value="<?php echo $this->escapeHtml($this->getAddress()->getPostcode()) ?>" class="input-text validate-zip-international <?php echo $this->helper('customer/address')->getAttributeValidationClass('postcode') ?>" />
</div>
</div>
and
I set to true in javascript
also
var billingForm = new VarienForm('co-billing-form',true);
May I know Where I went wrong? or how to do this?
Thanks.
Best Answer
You should be able to change the class from "validate-zip-international" to "validate-number" to add Magento's frontend JS validation for numbers, or "validate-digits".
Source: /js/prototype/validation.js for a list of all validation classes (addAllThese method)