hello, @unselectedLabel: let's think about the following scenario: users have the option to select an entry (emphasis on option). -> a user would like to discard his/her choice. with your suggestion there is no neutral field any more. -> the user has no easy possibility to deselect his/her choice.
ok - after the bug is fixed you have to use tr:selectItem instead of unselectedLabel to provide a permanent neutral option for the scenario above. or we have to introduce a new attribute (e.g. permanentUnselectedLabel or something similar, which indicates if the unselectedLabel should stay available or not). what's your opinion about that? @dynamic items: again just sample source code: <tr:selectOneChoice id="selectOne" value="-1" valueChangeListener="#{ bean.change}" autoSubmit="true" partialTriggers="selectOne" immediate="true"> <tr:selectItem label="Please choose" value="-1" rendered="#{!bean.valueSelected}"/> <f:selectItems value="#{bean.items}"/> </tr:selectOneChoice> within the bean: private boolean valueSelected; private List<SelectItem> items; public boolean isValueSelected() { return valueSelected; } public void setValueSelected(boolean valueSelected) { this.valueSelected = valueSelected; } public List<SelectItem> getItems() { if(items == null) { items = new ArrayList<SelectItem>(); for(int i = 0; i < 3; i++) { items.add( new SelectItem( i, "value: " + i ) ); } } return items; } public void setItems(List<SelectItem> items) { this.items = items; } public void change(ValueChangeEvent event) { setValueSelected( true ); } regards, gerhard 2007/12/12, Matthias Wessendorf <[EMAIL PROTECTED]>: > > this sounds odd to me as well. > > I would expect, the unselectedLabel goes away, once there was a selection. > > Do you mind to file a bug for this? > > -M > > On Dec 12, 2007 12:21 PM, Stephen Friedrich <[EMAIL PROTECTED]> wrote: > > Thanks for the answer. > > So basically you are saying I can't use > > <tr:selectOneChoice unselectedLabel="Please choose" ...> for this?! > > As you suggested I can "fake" that label myself, but I wonder what's the > > purpose of the trinidad attribute if it does not do this automatically. > > Part of the problem is that my select items are not hardcoded (are they > ever > > in real apps?), but based on a query. So I would have to wrap that query > in > > my backing bean to dynamically add/remove the unselected label. If I do > that > > I have to stop using entites (which are automatically converted to > select > > items by seam's s:selectItems), but will have to explicitly create > > SelectItems. Quite a mess for such a simple feature. > > > > The current behaviour seems like a bug to me. > > Why the heck does trinidad show an "unselected label" if there actually > _is_ > > a selection? > > > > > > > > hello, > > > > just a sample source code: > > > > <tr:selectOneChoice id="selectOne" value="0" > > valueChangeListener="#{bean.change}" autoSubmit="true" > > partialTriggers="selectOne" immediate="true"> > > <tr:selectItem label="Please choose" value="0" > > rendered="#{!bean.valueSelected}"/> > > <tr:selectItem label="one" value="1"/> > > <tr:selectItem label="two" value="2"/> > > </tr:selectOneChoice> > > > > > > within the bean: > > > > private boolean valueSelected; > > > > public boolean isValueSelected() > > { > > return valueSelected; > > } > > > > public void setValueSelected(boolean valueSelected) > > { > > this.valueSelected = valueSelected; > > } > > > > public void change(ValueChangeEvent event) > > { > > setValueSelected( true ); > > } > > > > regards, > > gerhard > > > > > > > > 2007/12/12, Stephen Friedrich < [EMAIL PROTECTED]>: > > I like to show "Please choose" in a selectOneChoice as long as no > > option has been selected, yet. > > As soon as the user selects one of the items the label should vanish > > from the list. > > (autoSubmit is set and the selectOneChoice is partialTrigger for > itself.) > > It really doesn't make any sense to select "Please choose" from > > the list after having already selected something for real. > > > > > > > > -- > > > > http://www.irian.at > > > > Your JSF powerhouse - > > JSF Consulting, Development and > > Courses in English and German > > > > Professional Support for Apache MyFaces > > > > -- > Matthias Wessendorf > > further stuff: > blog: http://matthiaswessendorf.wordpress.com/ > sessions: http://www.slideshare.net/mwessendorf > mail: matzew-at-apache-dot-org > -- http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces