2017-04-26 56 views

回答

1

要使用電話號碼驗證,你需要把數字字段按照下面給出的例子。

[number* your-number min:9 max:10 step:3 class:required "40"] 

參考鏈接:CF7

0

如果你想使用自定義驗證的手機號碼,那麼你可以使用jQuery也。

就像這樣:

$('.wpcf7-form .custom-field-class input').on('keypress', function(e) { 
    //if the letter is not digit then display error and don't type anything 
    if (e.which != 8 && e.which != 0 && (e.which < 43 || e.which > 57)) { 
      return false; 
    } 
}); 

將這個文件在形態存在或footer.php或自定義的js文件的頁面模板。

請將您的輸入字段包裝類替換爲custom-field-class,或者您可以根據您的要求修改您的類&輸入名稱。

希望,這可能對你有所幫助。