aspose file tools*
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
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