Hi Guys,
I want to generate the following dropdownlist from the controller:
echo Chtml::dropDownList('book_id','', $booksList,
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>'/index.php?r=book/dynamicauthor' ,
'update'=>'#author',
'data'=>array('book_id'=>'js:this.value'),
))); //selector to update));
But the url never call the action "dynamicauthor", but when i put this code in my view it works.
I know its not a good approach to put this in the controller, but for what i want to do, i have no choice, because this code must be generated and added dynamically when i click on an action from the view.
Im able to use this code and its works :
echo '<select id="Book_book_id" name="Book[book_id]">';
foreach($books2 as $id=>$value){
{
echo CHtml::tag('option',array('value' => $value['id']),CHtml::encode($value['name']),true);
}
echo '</select>';
but how can i use Ajax within the CHtml::tag ?
Thanks