Yii Framework Forum: onchange of a combobox changing the textbox value - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

onchange of a combobox changing the textbox value Rate Topic: -----

#1 User is offline   deepakparam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 17-August 16

Posted 19 August 2016 - 03:25 PM

Hello,

I new to yii framework. i am working on a sample project and got stuck at a point
and I don't know how to proceed from there. Please help me

in my active record form i have a combobox and a textfield. combobox is retriving data from a table.

my problem is i want the textbox to show the data according to combobox selection.

my table is having three columns
sid | share_name | exchange_rate
1 | gold | 100
2 | zinc | 30
3 | lead | 50

if I select the gold from the combobox it should display 100 in the textbox and if i select zinc from the combobox the textbox should display 30 and likewise.

i tried it do.but its not working, may be i am missing something...please help...

code for combobox

<?= $form->field($model,'Share_Name')->dropDownList(
ArrayHelper::map(Sharename::find()->all(),'Share_Name','Share_Name'),array('onchange'=>????), ['prompt'=>'Select Share']
) ?>

code for textbox
<?= Html::textInput( 'Exchange_Rate', 'sid', array('id'=>'Exchange_Rate')) ?>
0

#2 User is offline   hrnair 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 243
  • Joined: 09-December 12

Posted 19 August 2016 - 08:26 PM

'onchange'=>'here you can write the jQuery code' so that you get the result as you want.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users