0

I would like to display a dropdown list and text field according to the selection of a radio button in Yii form. ie, if I select the first option , it must display a dropdown list and if I select the second option the text box must appear. This is the code for my radio button:

  <?php echo $form->radioButtonList($model,'service_type',array('0'=>'Fixed Price Service','1'=>'Service at hourly rate'));?>

When selecting the "Fixed Price Service" the dropdown

<?php echo $form->dropdownList( $model, 'min_budget', array( "0"=>"Select your minimum budget", "1" => "10000", "2" => "20000", "3" => "50000", )); ?>

and on selecting "Service at hourly rate" the text field must appear

 <?php echo $form->textField($model,'hourly_rate',array('size'=>15,'maxlength'=>1)); ?>

this function must appear without refreshing or clicking any submit buttons. How can I implement this in Yii form ?

Kai
  • 38,985
  • 14
  • 88
  • 103
anu
  • 458
  • 2
  • 13
  • 36

1 Answers1

0

Use javascript or jquery hide and show functions for this... These links may help you

display/hide textbox based on drop down list

jQuery - How to show/hide text box based on selected drop down

Community
  • 1
  • 1
웃웃웃웃웃
  • 11,829
  • 15
  • 59
  • 91