selectonemenu

Selecting option in p:selectOneMenu using JS

断了今生、忘了曾经 提交于 2019-12-08 02:49:56
问题 I'm trying to pre-select the country of user in a selectOneMenu using javascript. The problem is that when the page initially loads the list is still on the first element. However if I click on the arrow to expand the list, and then click somewhere else on the page to make the list disappear, then the value is the one set by javascript. <p:selectOneMenu styleClass="inputField selectOneMenuColored" required="true" editable="false" id="country" value="#{subscribeUser.user.countryBean}"

Facelet selectOneMenu with POJOs and converter problem

浪子不回头ぞ 提交于 2019-12-06 15:49:54
I want to have a facelet page with a formular and a dropdown menu. With the dropdown menu the user shoul select a POJO of the type Lieferant: public class Lieferant extends AbstractPersistentWarenwirtschaftsObject { private String firma; public Lieferant(WarenwirtschaftDatabaseLayer database, String firma) { this(database, null, firma); } public Lieferant(WarenwirtschaftDatabaseLayer database, Long primaryKey, String firma) { super(database, primaryKey); this.firma = firma; } public String getFirma() { return firma; } @Override public String toString() { return getFirma(); } @Override public

Selecting option in p:selectOneMenu using JS

喜夏-厌秋 提交于 2019-12-06 13:34:34
I'm trying to pre-select the country of user in a selectOneMenu using javascript. The problem is that when the page initially loads the list is still on the first element. However if I click on the arrow to expand the list, and then click somewhere else on the page to make the list disappear, then the value is the one set by javascript. <p:selectOneMenu styleClass="inputField selectOneMenuColored" required="true" editable="false" id="country" value="#{subscribeUser.user.countryBean}" converter="#{countriesConverter}" effect="fold"> <f:selectItems value="#{countriesConverter.countries}" var=

How to update a selectonemenu depending on other one selected value?

女生的网名这么多〃 提交于 2019-12-06 04:47:17
I've been having a trouble trying to make my selectOneMenu content, depend on the value selected on the other. The content from the first one comes from a table in my DataBase and works perfectly, but the second one is supposed to come from another table, but I can't make it work. Here is my index.html , where I'm just trying to prove how this works: <h:outputLabel value="Estado" styleClass="requiredLbl"/> <p:selectOneMenu id="Estado" value="#{beanInscripcion.id_estado}" valueChangeListener="#{beanInscripcion.buscarMunicipios(event)}" > <f:selectItem itemLabel="Elegir Estado" itemValue="" />

<h:selectOneMenu> value change listener invoked for all dropdowns instead of only the current

这一生的挚爱 提交于 2019-12-06 01:45:44
I'm using MyFaces 1.1. I have two <h:selectOneMenu> s dropdowns which each point to same valueChangeListener method. <h:selectOneMenu id="d1" value="#{mybean.selectedChannel1}" onchange="submit()" valueChangeListener="#{myform.channelValuechange}"> <f:selectItems value="#{mybean.channelList}"/> </h:selectOneMenu> <h:selectOneMenu id="d2" value="#{mybean.selectedChannel2}" onchange="submit()" valueChangeListener="#{myform.channelValuechange}"> <f:selectItems value="#{mybean.channelList}"/> </h:selectOneMenu> When I change the first dropdown, then the value change listener method get fired

How to disable the required tag on a selectOneMenu when p:ajax event=change?

ε祈祈猫儿з 提交于 2019-12-05 13:47:55
Here is my configuration: PrimeFaces: 4.0.4 (elite) OmniFaces: 1.6.3 JSF: MyFaces 2.0.2 Server: WebSphere 8.5.0.2 Some code (I only post the relevant part for better clarity): <p:selectOneMenu value="#{viewModel.selectedContact}" required="true" converter="omnifaces.SelectItemsConverter"> <p:ajax event="change" listener="#{viewModel.updateContact}" update="area"/> <f:selectItem itemValue="#{null}" itemLabel="#{msg.no_contact}" noSelectionOption="true" /> <f:selectItems value="#{viewModel.contacts}"/> </p:selectOneMenu> So here, we have a simple p:selectOneMenu that contains a list of Contact

Invoke action method on click of h:selectOneMenu

那年仲夏 提交于 2019-12-04 23:07:21
I have the following drop down list: <h:selectOneMenu value="#{user.favCoffee3}" onclick=""> <f:selectItems value="#{user.favCoffee3Value}" var="c" itemLabel="#{c.coffeeLabel}" itemValue="#{c.coffeeValue}" /> </h:selectOneMenu> I would like to launch some method from the bean by drop down list item click. How can I achieve it? Konstantin Yovkov You can use the valueChangeListener attribute, pointing to a method in the managed-bean and add a submit() in the onchange attribute. The form should look like : <h:form> <h:selectOneMenu valueChangeListener="#{bean.valueChanged}" onchange="submit()">

p:selectOneMenu does not set value in bean

纵饮孤独 提交于 2019-12-04 17:45:42
问题 Quick question. This hasn't happened to me before when working with SelectOneMenu. This is my code. <h:outputLabel for="listaRegiones" value="Región: " /> <p:selectOneMenu id="listaRegiones" value="#{nuevaProvincia.regionSelect}" required="true"> <f:selectItems value="#{nuevaProvincia.regiones}" /> </p:selectOneMenu> <p:message for="listaRegiones" /> And this is my backing bean. @ManagedBean(name="nuevaProvincia") @ViewScoped public class nuevaProvincia implements Serializable { public static

JSF 2.0 - selectOneMenu defaults to 0 when empty

蓝咒 提交于 2019-12-03 20:33:54
For my project i want to implement a combobox with h:selectOneMenu . I read many posts about how to handle the selectOneMenu properly and how to implement a custom converter. The combobox shall store the ID ( Long ) from a different DB Table (named fk_ID) for which a constrain is in place. So far everything seems to function as planned. Now to my problem: The column fk_ID is optional, so the first option in the combobox is a f:selectItem with no value labeled "choose ...". When I save the form and change the value everything is OK, except if I set it back to "choose ...". The error I get is a

p:selectOneMenu does not set value in bean

雨燕双飞 提交于 2019-12-03 10:42:24
Quick question. This hasn't happened to me before when working with SelectOneMenu. This is my code. <h:outputLabel for="listaRegiones" value="Región: " /> <p:selectOneMenu id="listaRegiones" value="#{nuevaProvincia.regionSelect}" required="true"> <f:selectItems value="#{nuevaProvincia.regiones}" /> </p:selectOneMenu> <p:message for="listaRegiones" /> And this is my backing bean. @ManagedBean(name="nuevaProvincia") @ViewScoped public class nuevaProvincia implements Serializable { public static final long serialVersionUID = 1L; public nuevaProvincia() throws DAOException { this.provincia = new