0
重力形式的电话号码字段应该验证电话号码,但如果字段选项设置为“国际”,则表单提交如果字段中的数据是标准字符。重力形式验证号码字段
下面的代码挂钩到我的表单和特定字段,但我有问题如何检查字段字符串是否是数字。
// add custom validation to the gravity forms plugin to validate "phone number" field
add_filter("gform_field_validation_2_4", "custom_validation", 10, 4);
function custom_validation($result, $value, $form, $field){
if($result["is_valid"] && intval($value)){
$result["is_valid"] = false;
$result["message"] = "Please enter a valid telephone number";
}
return $result;
}
我希望你的建议和反馈。
谢谢, JB。