I’ve implemented dependent dropdowns based on this article and everything is working fine.
However what i would like is for the second dropdown to be hidden at first. On selecting a value other than the prompt, the second dropdown should appear, populated with the data. I can of course figure out the first step by adding a ‘hide’ class to it:
echo CHtml::dropDownList('university_id','', array(), array('class' => 'hide')); ?>
But is there a way of making the dropdown visible again easily in Yii? Selecting the prompt again should also hide the second dropdown again.
Here is the first dropdown
echo CHtml::dropDownList('country','', $countries, array( 'prompt'=>"Not Enrolled", // on clicking this, second dropdown disappears 'ajax' => array( 'type'=>'POST', //request type .... stuff
I could of course create a js file but I’m just wondering if there is a Yii way of doing it?