Open a dialog box in same window on selectOneMenu change
Posted
by
Pravingate
on Stack Overflow
See other posts from Stack Overflow
or by Pravingate
Published on 2012-06-02T15:08:29Z
Indexed on
2012/06/04
4:40 UTC
Read the original article
Hit count: 257
I have a jsf page where I have a selectOneMenu and , I want to open a dialog box on selectOneMenu changes.
As a example if user selects a value ="passive" from jsf selectOneMenu it should open a dialog box or a light box on same page where I want to display a small jsf form like as here done. http://www.primefaces.org/showcase-labs/ui/dialogLogin.jsf
and I also want save that submitted data in my backing bean somewhere so I can store it in to database later.
I dont know how to open a dialog box or light box from backing bean in same window,as we will identify value change using valueChangeListener event or by using ajax event.
I am able to identify which value is selected from selectOneMenu(DropdownMenu), but dont know how to open a dialog box on selecting particular value.
<h:outputLabel
value="* Country: "/>
<h:selectOneMenu
id="someSelect"
value="#{testController.countryName}"
required="true">
<f:selectItem
itemLabel="Select Country"
itemValue=""/>
<f:selectItems
value="#{testController.countryNamesSelectItems}"/>
</h:selectOneMenu>
Supoose we have 2 options in selectItems as India and Austrlia, then If a user choose India a dialog box should open on same page where a user need to fill some information and need to submit if he is from india (like here in example http://www.primefaces.org/showcase-labs/ui/dialogLogin.jsf user will put his username and password and submits data)
Hope this helps
How can I achieve that by using jsf or javascript or ajax or by any else way?
© Stack Overflow or respective owner