• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

richfaces :comboBox defaultLabel, required=false question

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

Please could you be more specific ?

Radu
 
pumpii breka
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry , for me is clear that i don't understand what you want.
reply
    Bookmark Topic Watch Topic
  • New Topic