0

I have a view in site/index.php where I have this dropdownList, is dependent of another one but so far is working great.

<?=  
       $form->field(new \app\models\Tours(), 'nombre')->dropDownList(
            [],
            [
                'prompt' => 'Programa',
                'id' => 'child1_child2'
            ]
        )->label(false);
 ?>

the problem with this is that I can't rescue the value of the option that is active in the dropdown.

When I change from one option to another there is no change in the html, In this image

Image

for example I selected the option "tour 6" but it should be something letting me know that I changed the default option to "tour 6" right?

I understand that I can do this with JS. I tried using the #id to interact with the option value, but I think there is something missing in my dropdown code in order to rescue the value of the selected option.

jwpfox
  • 5,124
  • 11
  • 45
  • 42
Rugleh
  • 37
  • 1
  • 10
  • http://stackoverflow.com/questions/1221957/jquery-to-retrieve-and-set-selected-option-value-of-html-select-element – Dmitry Zayats Nov 28 '16 at 08:34
  • I tested with jquery but i'm not getting any value on console, I really think there is a problem with the code of my widget (yii2) – Rugleh Nov 28 '16 at 08:41

0 Answers0