• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

<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: 28468
210
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.
 
It would give a normal human mental abilities to rival mine. To think it is just a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic