Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

<h:selectOneMenu> issue

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting exception, while retrieving the selected value of '<h:selectOneMenu>' with 'onchange' event. can you please tell me what is wrong with this code?

code in xhtml page:


code in flow:

Exception received:

I would like to pass the value of selected value 'selectOne' as the actionParam value to the flow.

Can you please tell me what is wrong with the EL expression?
 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<f:param name="state" value="#{document.getElementById('myForm.state').value}" /> I think it should be myform.states because the id for the select menu is states not state.
 
Naresh Gunda
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry! I have corrected the typo.


still I am getting ELException.

 
Vaibhav Mittal
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not think you can pass a javascript function in a value expression. The value tag expects EL expression. You do not need to pass any parameter. You can retrieve the value by calling the getState as the new value for the state would already have been set. So just skip the whole line
<f:param name="state" value="#{document.getElementById('myForm.state').value}" />
and use getState() where ever you need the state selected. It should work.
 
Saloon Keeper
Posts: 27926
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vaibhav is correct. EL value expressions must refer to server-based objects, and JavaScript works on client-based objects.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic