CActiveForm and enable submit button

Hi,

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(

  ...

  'enableAjaxValidation'=>true,

  'clientOptions' => array(

	...

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

  	if(!hasError)

  	{

    	// show button

  	}

  	return false;

	}',

  ),

));



Hi,

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.