CActiveForm and enable submit button


like in topic. How can I enable submit button (e.g. button will show) when all fields in my form is validated. I use CActiveForm with ajax validation (validateOnChange=true).

Thanks for suggestion.

Try such code:

$form=$this->beginWidget('CActiveForm', array(



  'clientOptions' => array(


	'afterValidate' => 'js:function(form, data, hasError){



    	// show button


  	return false;





I have tried but afterValidate is available only when validateOnSubmit is set true.I have set: validateOnChange=true (default setting)

May be afterValidateAttribute handler will help you, it also has param hasError which indicates if there any validation errors.