I am creating a form and I have a problem in a combo, I created an action to select what I really wanted to bring in the database, but I would like to send this to the combo below, and I’m having problems in that, can anyone help me?
I am creating a form and I have a problem in a combo, I created an action to select what I really wanted to bring in the database, but I would like to send this to the combo below, and I’m having problems in that, can anyone help me?
Would you please elaborate? What is “combo”?
Follow the _form code:
<?php
echo $form->dropDownListRow($modelForm,'codmaterial',CHtml::listData(Materiais::model()->findAll(array('order'=>'descricao ASC')),
'codmaterial', 'descricao'),array('prompt'=>'Selecione...','ajax' => array( 'type'=>'POST', //request type
'url'=>$this->createUrl('Leilao/materiais/'), //url to call.
'update'=>'#Leilao_materiais', //selector to update
),'class'=>'span5'));
?>
<?php echo $form->dropDownListRow($model,'codclassificacao',$model->ge; ?>
Follow the action in controller code:
public function actionMateriais()
{
$materiais=Classificacao::model()->findAll('codmaterial='.$_POST['LeilaoForm']['codmaterial']);
$materiais=CHtml::listData($materiais,'codclassificacao','classificacao');
//$dataMunicipio=CHtml::listData(Municipios::model()->findAllBySql("select nome
// from municipios where cod_sre = $sr ORDER BY nome DESC" ) ,'cod_municipio', 'nome');
foreach($materiais as $value=>$name)
{
echo CHtml::tag('option',
array('value'=>$value),CHtml::encode($name),true);
}
}
So what is “combo” in this code and what do you want to send exactly?