简体   繁体   English

限制“文本字段”以magento形式仅接受数字和最多10个数字

[英]restrict the “textfield” to accept only digits and maximum 10 digits in magento form

here is a code : http://pastebin.com/qCNGSKRn to display telephone filed to enter telephone number. 这是一个代码: http : //pastebin.com/qCNGSKRn以显示输入的电话号码并输入电话号码。

i want to restrict above field to accept only numbers and also maximum 10 numbers to be entered. 我想将以上字段限制为仅接受数字,并且最多只能输入10个数字。 all special charactars and special symbols and white spaces should not allowed. 禁止使用所有特殊字符,特殊符号和空格。

that field should not accept more than 10 digits. 该字段不能接受超过10位数字。

please help me to find solution. 请帮助我找到解决方案。

<div class="field">
                <label for="telephone" class="required"><em>*</em><?php echo $this->__('Telephone') ?></label>
                <div class="input-box">
                    <input type="text" name="telephone" value="<?php echo $this->escapeHtml($this->getAddress()->getTelephone()) ?>" title="<?php echo $this->__('Telephone') ?>" class="input-text  <?php echo $this->helper('customer/address')->getAttributeValidationClass('telephone') ?>" id="telephone" />
                </div>
            </div>

i have to use this in class " class="input-text validate-length maximum-length-10 minimum-length-10 validate-digits helper('customer/address')->getAttributeValidationClass('telephone') ?>"" https://magento.stackexchange.com/questions/56413/restrict-the-textfield-to-accept-only-digits-and-maximum-10-digits-in-magento 我必须在类“ class =“ input-text validate-length maximum-length-10 minimum-length-10 validate-digits helper('customer / address')-> getAttributeValidationClass('telephone')?>”“中使用此” https://magento.stackexchange.com/questions/56413/restrict-the-textfield-to-accept-only-digits-and-maximum-10-digits-in-magento

http://inchoo.net/magento/out-of-the-box-form-validation-in-magento/ http://inchoo.net/magento/out-of-the-box-form-validation-in-magento/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM