Yii CActiveForm with AJAX

Hi,

Is there an easy way to implement AJAX into a form to create say a cascading drop down list where what you choose in the first list will limit what you can see in the next and so forth. I’m using the CActiveForms created by gii and I was wondering if I could keep using those.

Thanks,

-Nazum

Yes, you can keep on using

Add selectors(id,class) using htmlOptions to the select boxes so you can then use js normally and do what you want

something like

//php code




$form->dropDownList($model,'attributeName',array(1=>'yes',2=>'no'),array('id'=>'mySelect'));

$form->dropDownList($model,'otherAttributeName',array(1=>'so yes ?',2=>'so no ?'),array('id'=>'myOtherSelect'));



//js code




$("#mySelect").change(function(){

	value=$(this).find('option:selected').val();

	$("#myOtherSelect").find('option[value!='+value+']').hide();

	//or to select

	$("#myOtherSelect").val(value);

});



something like that

I was actually thinking along the lines of populating the second list but I get the idea. Thanks!!