Hi All,
Recently got to manage a site developed in YII. Learning the framework on the fly. Given my use case below. Searched almost a day in forums but in vain. Much appreciate any pointers. I have a dropDownList which should simply show 0,1,2,3,4,5…‘n’. The numbers should be dynamically changed based on another array populated in the same page. If the array has 3 elements, the list should show only 0,1,2,3. The array can be changed by the user dynamically in the same page.
How can I change the dropDownList dynamically without reloading the page. With jQuery/JS can I dynamically change the list? If so, how can it be done?
[i]Code:
<div class="row">
<?php echo $form->labelEx($model,'required_courses'); ?>
<?php echo $form->dropDownList($model,'required_courses',
array('' => 'Please select required number of courses') + ("1"=>"1", "2"=>"2", "3"=>"3"),
array('class' => 'span-7')); ?>
<?php echo $form->error($model,'required_courses'); ?>
</div>[/i]
The list is static now. I cannot post the complete page. The other array is coursesArray(). This can be dynamically changed through JS in the same page.