This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes unable to retrive value from a dropdown menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "unable to retrive value from a dropdown menu" Watch "unable to retrive value from a dropdown menu" New topic
Author

unable to retrive value from a dropdown menu

Ophola Maseti
Greenhorn

Joined: Feb 23, 2012
Posts: 1
hi, i am trying to get a selected item from a select dropdown menu in a dialog and put the value into a setPropertyActionListener that will in turn put it on a textbox of the parent form. when i put a hard-coded value, i can see it on the parent form. it returns a blank when when i am trying to get the selected value from the select dropdown menu, is there something wrong that i am doing?

<select size="1" id="stateSelect">
<option selected="selected" value="on">on</option>
<option value="off">off</option>
</select>
<p:commandButton update="#{p:component('state')}"
onsuccess="myDialog.hide();" value="Update" title="Update status">
<f:setPropertyActionListener target="#{config.connConfig.state}"
value="#{stateSelect.options[stateSelect.selectedIndex].value}"/>
</p:commandButton>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: unable to retrive value from a dropdown menu