Hi,
I have the following form where a textbox will be enabled when "Other" option in radio button is selected. I would like to know how to save only the value of the textbox when they select other and type some data in the textbox.
Form.php
<div class="row">
<?php echo $form->labelEx($model,'que1'); ?>
<?php echo $form->radioButtonList($model,'que1',array("iOS"=>"iOS","Android"=>"Android","Windows Mobile"=>"Windows Mobile","Blackberry" => "Blackberry","Other"=>"Other(Please specify)"),array('onchange'=>'return muFun(this.value)')); ?>
<?php echo $form->error($model,'que1'); ?>
</div>
<div id="check_1" style="display:none">
<div class="row">
<?php echo $form->textField($model,'que1',array('size'=>60,'maxlength'=>512)); ?>
</div>
</div>
<script>
function muFun(obj){
if(obj=="Other"){
document.getElementById('check_1').style.display="block";
return false;
}else{
document.getElementById('check_1').style.display="none";
return false;
}
}
</script>