Wednesday, 15 April 2015

php - Make visible a dropdown list and text box according to selection of a radio button -



php - Make visible a dropdown list and text box according to selection of a radio button -

i display dropdown list , text field according selection of radio button in yii form. ie, if select first alternative , must display dropdown list , if select sec alternative text box must appear. code radio button:

<?php echo $form->radiobuttonlist($model,'service_type',array('0'=>'fixed cost service','1'=>'service @ hourly rate'));?>

when selecting "fixed cost service" dropdown

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

and on selecting "service @ hourly rate" text field must appear

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

this function must appear without refreshing or clicking submit buttons. how can implement in yii form ?

use javascript or jquery hide , show functions this... these links may help you

display/hide textbox based on drop downwards list

jquery - how show/hide text box based on selected drop down

php yii yii-components

No comments:

Post a Comment