You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Stephen Friedrich <tr...@eekboom.com> on 2007/12/12 02:07:03 UTC

[Trinidad] selectOneChoice: Make "unselectedLabel" item go away after selection?

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.

Re: [Trinidad] selectOneChoice: Make "unselectedLabel" item go away after selection?

Posted by Gerhard Petracek <ge...@gmail.com>.
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 <tr...@eekboom.com>:
>
> 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