| Author |
richfaces :comboBox defaultLabel, required=false question
|
pumpii breka
Greenhorn
Joined: May 05, 2010
Posts: 3
|
|
The comboBox defaultLabel element is disappeared from the list when a user change value.
required="false"
How can I do that the user can set the first element (which is the default label) again?
triki
|
 |
Radu Mircea
Ranch Hand
Joined: Jun 14, 2009
Posts: 45
|
|
Hi ,
Please could you be more specific ?
Radu
|
 |
pumpii breka
Greenhorn
Joined: May 05, 2010
Posts: 3
|
|
For example : I have this component on a search form:
<rich:comboBox required="false" value="#{searchController.sessionData.unionSearchCrit}">
<f:selectItem itemValue="Oregon" />
<f:selectItem itemValue="Pennsylvania" />
<f:selectItem itemValue="Rhode Island" />
<f:selectItem itemValue="South Carolina" />
</rich:comboBox>
When the form is shown first time there is no choosen item. This is blank.
And if user chooses an item he will not able to choose the blank ("first") item till then he reload the page.
So I would like to allow for user can cancel his decision.
triki
|
 |
Radu Mircea
Ranch Hand
Joined: Jun 14, 2009
Posts: 45
|
|
Why you don't add <f:selectItem itemValue="" /> to your item's list having something like this:
<rich:comboBox required="false" value="#{searchController.sessionData.unionSearchCrit}">
<f:selectItem itemValue="" />
<f:selectItem itemValue="Oregon" />
<f:selectItem itemValue="Pennsylvania" />
<f:selectItem itemValue="Rhode Island" />
<f:selectItem itemValue="South Carolina" />
</rich:comboBox>
Any way rich:comboBox does not recognize itemLabel property so when user chooses itemValue="" empty string will be stored in your bean. Because of this (not recognize itemLabel property ) some converter issues can occur, but this is another discussion .
Please let me know if i understood right your need.
Regards,
Radu
|
 |
pumpii breka
Greenhorn
Joined: May 05, 2010
Posts: 3
|
|
I understand this.
The problem is that we use <f:selectItems ......
And we fill the list dynamically from the database tables.
There is occurrence with required and there is occurrence with not required.
We would like to control this with attribute like a required..
|
 |
Radu Mircea
Ranch Hand
Joined: Jun 14, 2009
Posts: 45
|
|
|
Sorry , for me is clear that i don't understand what you want.
|
 |
 |
|
|
subject: richfaces :comboBox defaultLabel, required=false question
|
|
|