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