I have the following coding,
<?php echo $form->dropDownListRow($model,'guesstype',array(''=>'--select--','logo'=>'Logo','apaters'=>'Apaters','text'=>'Text'),array('class'=>'span5','maxlength'=>255)); ?>
When i am choosing logo means, the input field becomes fileFieldRow,
<?php echo $form->fileFieldRow($model,'logo',array('class'=>'span5','maxlength'=>255)); ?>
When i am choosing text means, the input field becomes textFieldRow,
<?php echo $form->textFieldRow($model,'name',array('class'=>'span5','maxlength'=>255)); ?>
How to change input field based upon selected value in select list. Please help me.
i'm not sure, but i think you have to do something like this with jQuery,
<?php
Yii::app()->clientScript->registerScript('helloscript',"
$(document).on('change', '#id-of-dropdown', function() {
if ($(this).val() == dropdown_value_that_you_want_to_match) {
$('#id-of-element').show();
} else {
$('#id-of-element').hide();
}
});
",CClientScript::POS_READY);
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.