干草全部,我正在尝试验证kohana 3.0中的选择,我正在使用必要的规则.但是,当用户没有做出选择时,验证不会"启动".
<select id="discipline" name="discipline" >
<option value="0"> -- Select One -- </option>
<option value="-2">Information Technology and Engineering</option>
<option value="4">Business and Training Seminars</option>
</select>
Run Code Online (Sandbox Code Playgroud)
这是我的选择,现在我已经在检查验证错误之前将这些规则应用于post数组.
$post = Validate::factory($_POST)
->rule('discipline', 'not_empty')
->rule('discipline', 'numeric');
Run Code Online (Sandbox Code Playgroud)
当我在没有做出选择的情况下提交表单时,表单提交并且规则应该停止.
有任何想法吗 ?