javascript - Yii - Retrieve Drop Down Value before form submit. -
I have a web page with the menu drop down and many other stuff I want to retrieve the value of the dropdown menu , I know that $ _POST can be used after submission. But I want to get it before the presentation and so I want to use the javascript code.
document.getElementById (). Value; I am confused about how to write this code in my form page.
$ form-> Dropdown list ($ model2, 'anonymous' CHtml :: listData (lists :: model () - & gt; search (), 'anonymous', 'anonymous')); How do I call JavaScript in the form page?
dropdown id like yourModelname_ename of your dropdown Get the ID and use this code
var dom = document.getElementById ("idofyourdropdown"); Var results = dom option [DOM SelectedIndex]. Text; // Give selected text
Comments
Post a Comment