Yii下的CActiveForm的OnSubmit事件的处理,js函数的后续验证的解决方案!

beginWidget(‘CActiveForm’, array(
‘id’ => ‘question_order-_form-form’,
‘enableAjaxValidation’ => true,
‘enableClientValidation’ => true,
‘clientOptions’ => array(
‘validateOnSubmit’ => true,
‘afterValidate’ => ‘js:submit_checkout’,
),
‘htmlOptions’ => array(
‘autocomplete’ => ‘off’
)
)); ?>
js函数的实际规则为:
if (hasError == false) {
return false;
} else {
return true; // 返回true的话就会继续执行表单提交操作!
}
近期评论