Now, how to populate another dropDownList?
In PRADO I use this:
$series = $this->getSeriesByIdCurso($idCurso);
$this->DropSerie->setDataSource($series);
$this->DropSerie->dataBind();
In Yii, the dropDownList should be active?
Someone help me?
Posted 19 December 2008 - 03:14 PM
$series = $this->getSeriesByIdCurso($idCurso);
$this->DropSerie->setDataSource($series);
$this->DropSerie->dataBind();
Posted 19 December 2008 - 03:16 PM
Posted 22 December 2008 - 03:17 PM
<?php echo CHtml::dropDownList('curso', '', CHtml::listData($curso, 'id_curso', 'nome'), array('style'=>'width:200px', 'prompt'=>'Selecione...', 'ajax'=>array('type'=>'POST', 'replace'=>'id_serie'))) ?>
<?php echo CHtml::activeDropDownList($serie, 'id_serie', CHtml::listData($serieList, 'id_serie', 'nome'), $htmlOptions = array('multiple'=>'multiple', 'style'=>'width:200px; height:60px')); ?>
public function actionCalendario() { // index
if(Yii::app()->request->isAjaxRequest){
$this->actionCarregaSerie();
}
....
$serie = new serie;
$serieList = array(); // empty array on first view.
$this->render('calendario',array(
'curso'=>$curso,
'tipoeventoList'=>$tipoeventoList,
'avaliacaoList'=>$avaliacaoList,
'turnoList'=>$turnoList,
'serie'=>$serie,
'serieList'=>$serieList,
));
}
public function actionCarregaSerie()
{
$serie = new serie;
$serie->id_curso = $_POST['curso'];
$sql = "SELECT * FROM `serie` WHERE id_curso = $serie->id_curso";
$serieList = serie::model()->findBySql($sql);
}
Posted 23 December 2008 - 08:42 AM
public function actiondrop()
{
$this->render('drop', array(
'countries' => $this->dataCountry,
'states' => array(),
));
}
public function actionloadStates()
{
$return = '';
foreach ($this->dataStates[$_POST['country']] as $idState => $state){
$return .= "<option value='{$idState}'>{$state}</option>";
}
echo $return;
}
<?php echo CHtml::form(); ?>
<?php
echo CHtml::dropDownList('country', '', $countries, array( //htmloptions
'ajax' => array(
'type'=>'POST',
'url'=>'index.php?r=site/loadStates',
'update'=>'state',
),
));
?>
<br/>
<br/>
<?php echo CHtml::dropDownList('state', '', $states); ?>
<?php echo CHtml::closeTag('form'); ?>
Posted 23 December 2008 - 09:23 AM
Posted 23 December 2008 - 12:00 PM
Posted 23 December 2008 - 01:27 PM
<option value='0'>Rio de Janeiro</option><option value='1'>Brasilia</option><option value='2'>Sao Paulo</option>
<option value='0'>Florida</option><option value='1'>New York</option>
Posted 23 December 2008 - 02:03 PM
Posted 23 December 2008 - 02:44 PM
Posted 23 December 2008 - 02:47 PM
Posted 01 September 2010 - 03:17 AM
$related=CHtml::listData(layouts::model()->findAll(),'id','nome');
echo CHtml::activeDropDownList(
$model,
"layout_id",
$related,
array(
'empty'=>'**Seleziona un layout**',
'ajax'=>array(
'type'=>'GET',
'replace'=>'#campagne_template_id'
)
)
);
Posted 01 September 2010 - 08:09 AM
$related=CHtml::listData(templates::model()->findAll(),'id','nome');
echo CHtml::activeDropDownList($model, 'template_id', $related, array('empty'=>'**Seleziona un layout**'));