Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

selection to change JSF page immediately (without submit)  RSS feed

 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there guys,

I'm confused about how the immediate=true option works as well as the valueChangeListener. They both seem to work when the page gets submitted. What I need to do is (preferably without scripting) the following.

<hutputText value="Type" />
<h:selectOneMenu value="#{myBean.type}">
<f:selectItem itemValue="1" itemLabel="Once"/>
<f:selectItem itemValue="2" itemLabel="Weekly"/>
<f:selectItem itemValue="3" itemLabel="Monthly"/>
</h:selectOneMenu>

<h:panelGroup rendered="#{myBean.type == 1}">
<hutputText value="You have selected ONCE"/>
</h:panelGroup>
<h:panelGroup rendered="#{myBean.type == 2}">
<hutputText value="You have selected WEEKLY"/>
</h:panelGroup>
<h:panelGroup rendered="#{myBean.type == 3}">
<hutputText value="You have selected MONTHLY"/>
</h:panelGroup>

Hopefully the above is all explanation necessary. I want the page to change as the user selects another option on the drop down box. I do not want to submit the page, because there is a whole bunch of other stuff on this same page that will fail validation if the page submits, also I would like to keep the rendered item a select box. Can anyone point me in the right direction here, or simple is scripting the only way to achieve this?

cheers
Darryl
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"immediate" is an option to short-circuit the normal flow on a JSF submit.

JSF pages are rendered as HTML, and HTML can only be modified after it's received by a client-side script. The core JSF package doesn't have any provision for client-side scripting.

Fortunately, there's more available than core JSF. What you're describing is done very easily using the RichFaces tag set. RichFaces was developed by Exadel, and is now part of the RedHat/JBoss set of J2EE resources.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!