-
1. Re: Cannot select "" value with rich:select
mp911de Aug 24, 2011 1:13 AM (in response to andrejs)Hi Andrej,
have you got also an selectItem with label=""/value=""?
Best regards,
Mark
-
2. Re: Cannot select "" value with rich:select
andrejs Aug 24, 2011 1:32 AM (in response to mp911de)rich:select use not SelectItem Object, only String Object value:
in backing bean>
List<String> myValues = new ArrayList<String>()
myValues.add("");
...
in .xhtml
<rich:select ...>
<f:selectItems value="#{myBackingBean.myValues} />
</rich:select>
Problem: i can't changed item to value with ""
-
3. Re: Cannot select "" value with rich:select
mp911de Aug 24, 2011 3:25 AM (in response to andrejs)Hi Andrej,
that's not correct (according to docs). You would need a Collection/Array of SelectItem's
List<SelectItem> myValues = new ArrayList<SelectItem>();
myValues.add(new SelectItem("",""));
myValues.add(new SelectItem("value1","Label 1"));
myValues.add(new SelectItem("value2","Label 2"));
- Using multiple
<f:selectItem>
tags <rich:select>
<f:selectItem itemValue="0" itemLabel="Option 1" />
<f:selectItem itemValue="1" itemLabel="Option 2" />
<f:selectItem itemValue="2" itemLabel="Option 3" />
<f:selectItem itemValue="3" itemLabel="Option 4" />
<f:selectItem itemValue="4" itemLabel="Option 5" />
</rich:select>
- Using a single
<f:selectItems>
tag <rich:select>
<f:selectItems value="#{bean.options}" />
</rich:select>
Best regards,
Mark
- Using multiple
-
4. Re: Cannot select "" value with rich:select
andrejs Aug 24, 2011 4:18 AM (in response to mp911de)don't works :-(
works if value is not empty!
<rich:panel>
<f:facet name="header">
<h:outputText value="MyValues"/>
</f:facet>
<a4j:jsFunction name="setNewValue">
<a4j:param name="newValue" assignTo="#{myBean.newValue}"/>
</a4j:jsFunction>
<rich:select id="input" enableManualInput="true" defaultLabel="#{myBean.myValue}"
onselectitem="setNewValue(document.getElementById('myId').value)">
<f:selectItem value="" />
<f:selectItem value="notEmpty" />
...
.... />