Hi,
I use 3.3-SNAPSHOT. Some release between yesterday and this morning must have broken the p:selectOneMenu component. I guess it was this one: http://code.google.com/p/primefaces/sou ... ail?r=7310
First of all, the component becomes too small when a noSelectOption is selected. I could easily fix this by setting the height of ".ui-selectonemenu label" to whatever it was at my specific font-size (14px).
The more important issue is, that on submits, it won't submit a value anymore. This is only a bug when using Firefox. Using Chrome, everything works fine. Also, this (most likely) only happens when there is a noSelectOption in the menu.
I will try and post a reproducable example in a minute.
Regards,
Philipp
// EDIT: Might also have been a little older release, I don't know which exact version I had yesterday.
// EDIT2: Meanwhile, I could reproduce, that when there is a noSelectOption in my selectOneMenu, the label of the selectOneMenu will be cleared when/before submitting the form. The value does not appear in the request (Firebug). Chrome does not clear the label and the value appears in the request. When there is no noSelectOption, it works in both browsers.
[3.3] SelectOneMenu broken
To reproduce, do the following:
- Use the latest 3.3-SNAPSHOT
- Create a backing bean:
- Create a test.xhtml:
These steps will work in Chromium as expected, but not in Firefox:
Open the test page. Make sure that the Backing Bean holds 'null' as the value for the field, for example by hitting STRG+F5. The noSelectionOption will be selected and the value will be null. Change the value to either val1 (or val2) and click the button. You would expect the content of the text field to change to "val1", but on Firefox, this doesn't happen. However, when you select another item and click the button again, it works. Firebug shows, that form:select_input is included in the request, but has no value.
Regards,
Philipp
- Use the latest 3.3-SNAPSHOT
- Create a backing bean:
Code: Select all
@ManagedBean
@ViewScoped
public class TestBean implements Serializable {
private static final long serialVersionUID = 1L;
public enum MyEnum {
val1, val2
}
public MyEnum field;
public MyEnum getField() {
return field;
}
public void setField(MyEnum field) {
this.field = field;
}
public MyEnum[] getMyEnumValues() {
return MyEnum.values();
}
}
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head> <title>Test</title></h:head>
<h:body width="100%">
<h:form id="form">
<p:selectOneMenu value="#{testBean.field}" id="select">
<f:selectItem itemValue="#{null}" itemLabel="" noSelectionOption="true" />
<f:selectItems value="#{testBean.myEnumValues}" var="m" itemLabel="#{m.toString()}" />
</p:selectOneMenu>
<p:commandButton id="btn"
process="select"
update="txt" />
<p:inputText id="txt"
value="#{testBean.field}"
readonly="true" />
</h:form>
</h:body>
</html>
Open the test page. Make sure that the Backing Bean holds 'null' as the value for the field, for example by hitting STRG+F5. The noSelectionOption will be selected and the value will be null. Change the value to either val1 (or val2) and click the button. You would expect the content of the text field to change to "val1", but on Firefox, this doesn't happen. However, when you select another item and click the button again, it works. Firebug shows, that form:select_input is included in the request, but has no value.
Regards,
Philipp
Last edited by Philipp on 06 Apr 2012, 14:10, edited 1 time in total.
Glassfish 3.1.2, PrimeFaces 3.4.2
Also, I noticed, that it is not possible anymore to select the noSelectionOption. Instead, the first option after the noSelectionOption will be selected. Is this a bug or a feature? If it is a feature, I need to turn it off.
Last edited by Philipp on 06 Apr 2012, 14:10, edited 1 time in total.
Glassfish 3.1.2, PrimeFaces 3.4.2
Using <f:selectItem itemValue="" itemLabel="" /> instead of the noSelectOption with a null value solved the problem. However, the converters needed to be extended in order to convert "" to null and vice-versa.
This is a working solution for all browsers and also it is now possible to re-select the "noSelectOption", but still, I would consider the behaviour I showed above a PrimeFaces (or Firefox) bug.
This is a working solution for all browsers and also it is now possible to re-select the "noSelectOption", but still, I would consider the behaviour I showed above a PrimeFaces (or Firefox) bug.
Glassfish 3.1.2, PrimeFaces 3.4.2
-
- Information
-
Who is online
Users browsing this forum: No registered users and 28 guests