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 can anybody help ?? 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 "can anybody help ??" Watch "can anybody help ??" New topic
Author

can anybody help ??

sudhasrinivas pallam
Ranch Hand

Joined: Oct 06, 2008
Posts: 37
Hi
This is srinivas
I developed a page with 4 dropdown lists
Now i want to change the behaviour of the dropdown lists
Intially only one dropdown list must appear
when i select any option from the list other dropdown list must appear
The code i used is


please post any suggestions
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

for this functionality do one thing.

on onselect event submit the form and call one action. that action will set the rendered property true of the next drop down. same for rest two also.


My Blog SCJP 5 SCWCD 5
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Hi sudhasrinivas,

I'm not an expert in JSF - so I can only give you some basic advises to your code.

1. you need to submit each time the value in the dropdown changes - use "onchange" attribute in 'h:selectOneMenu' which referrer to a JavaScript function from where you submit.

2. use some kind of boolean 'flag' to control when the other dropdown(s) should be shown - when you submit, you enter your java action bean, here you set a flag, and return to the same web page you came from (I think that the attribute to use in 'h:selectOneMenu' is called 'rendered').


Regards, Rene Larsen
Dropbox Invite
Himanshu Gupta
Ranch Hand

Joined: Aug 18, 2008
Posts: 598

Yes Rene you are correct. The problem can be solved in this way.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: can anybody help ??
 
Similar Threads
JSF
Adding space between Radio button and Label
javax.xml.rpc.soap.SOAPFaultException: System.Web.Services.Protocols.SoapException:
MyFaces Tomahawk : Radio buttons in t:dataTable
How to set Default selection in h:selectOneMenu