0
我從Codecanyon購買了Quform wordpress插件。插件非常棒 - 它允許您爲表單創建自定義驗證器,如http://support.themecatcher.net/quform-wordpress/guides/customization/creating-a-custom-validator所示。Quform Wordpress插件中數組值的自定義驗證
上面的例子只處理一個驗證單個值。如果我有500個呢?
這是我的代碼。
function custom_validator($valid, $value, $element, $rcnumber)
{
$rcnumber = array('103184','104351','104359','103912','104389','104400','100505','102180','103530','104455','79162','74233','26451','75140','289752','101785','103141','26646','103178','100567','75159','103744','103244','78557','103330','102602'<500 numbers....>,);
if ($value != $rcnumber) {
$element->addError('Invalid RC Number');
$valid = false;
}
return $valid;
}
add_filter('iphorm_element_valid_iphorm_14_11', 'custom_validator', 10, 3);
這段代碼的問題是,無論我在rcnumber字段中輸入什麼樣的價值我不斷收到「無效RC數」的錯誤,即使數量是其中rcnubmer數組中列出500。我究竟做錯了什麼? 謝謝!