I have a dropdownlist that is supposed to update a textbox via ajax:
in my view form I have a table that goes like this:
<table>
<tr><th>Tipo</th><th>Descrição</th><th>Qtd.</th><th>Preço</th><th>Tx.Iva</th></tr>
<tr>
<td>
<?php
echo CHtml::ajaxLink(
'Update text',
array('faturas/ES', 'cod' => 5), // <---- This one works fine
array('update' => '#teste')
);
echo CHtml::dropDownList('codservico1', '',$listaservicos,
array(
'ajax' => array(
'type'=>'POST',
'url' =>CController::createUrl('faturas/ES'), //<--This one never works. why?
'update'=>'#teste',
'data' => array('cod'=>5),
),
'empty' => 'Escolha o tipo',
));
?>
<?php echo $form->error($model,'codservico1'); ?>
</td>
<td><div id="teste"><?php echo CHtml::textField('servico1','',array('size'=>25)) ; ?></div></td>
<td><?php echo CHtml::activeTextField($model,'quantidade1',array('size'=>5)); ?></td>
<td><?php echo CHtml::activeTextField($model,'preco1',array('size'=>5)); ?></td>
<td><?php echo CHtml::activeTextField($model,'taxiva1',array('size'=>5)); ?></td>
</tr>
</table>
The ajax link works fine, but when the user chooses some item from the dropdown… nothing happens…
I’m tired and probably making some stupid mistake… Can anyone help me?