File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

richfaces :comboBox defaultLabel, required=false question

 
pumpii breka
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Please could you be more specific ?

Radu
 
pumpii breka
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 45
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry , for me is clear that i don't understand what you want.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic