This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JSF and the fly likes Hide/Show form fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Hide/Show form fields" Watch "Hide/Show form fields" New topic
Author

Hide/Show form fields

Pradeep Chandrasekharan Nair
Ranch Hand

Joined: Apr 01, 2004
Posts: 48
Hi,

Is there any way to show/hide fields using JSF rather than javascript. Actually my scenario is that I have to show some fields if I select a particular value from <selectOneMenu>

Thanks in Advance
Regards,
Pradeep
Gabriel Claramunt
Ranch Hand

Joined: May 26, 2007
Posts: 375
Use the rendered attribute of the JSF components.
I had a similar situation, and I used it successfully.
The main selection used immediate="true" (to avoid validations), and the action in the backing bean was used to set a boolean flag (something like "modeA"), the other JSF components had rendered=#{backingBean.modeA} or rendered=#{!backingBean.modeA} if they should appear in mode A or not.
Probably you can do it also with rendered=#{backingBean.selectionValue==XX} and avoid the use of a flag


Gabriel
Software Surgeon
Pradeep Chandrasekharan Nair
Ranch Hand

Joined: Apr 01, 2004
Posts: 48
Thanks Gabriel. Its working.

Pradeep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hide/Show form fields
 
Similar Threads
JQuery replace div
how to hide and show contents with struts2 div tag
show/hide formfields
Need Help with Ajax + AJaxStart + spinner
Is it a bad design to use a single conf dialog for all modes?