繁体   English   中英

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

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

这是一个代码: http : //pastebin.com/qCNGSKRn以显示输入的电话号码并输入电话号码。

我想将以上字段限制为仅接受数字,并且最多只能输入10个数字。 禁止使用所有特殊字符,特殊符号和空格。

该字段不能接受超过10位数字。

请帮助我找到解决方案。

<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>

我必须在类“ 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/

暂无
暂无

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

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