You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Matthias Wessendorf <ma...@apache.org> on 2008/04/16 12:51:32 UTC

Re: How to remove selection from a tr:selectManyListBox

Hi

On Wed, Apr 16, 2008 at 7:25 AM, dushyant agarwal
<ag...@yahoo.co.in> wrote:
>  Hi,
> Let us suppose that a JSF page consists of a tr:selectManyListBox and a
> tr:commandButton.
> On clicking on an option in the list box that option gets highlighted.
> If press the commandButton then the page simply reloads with the slected
> option in the list still highlighted.
>
> If we want to remove the selection from the list box on submitting the page
> how shall we do it?

If you want to reset the value inside your action method (the one
invoked by the command button), do that inside:

...
UIXEditableValue many = (UIXEditableValue)
FacesContext.getCurrentInstance().getViewRoot().findComponent("IdOfYourManyListboxComponent");
many.resetValue();
...


>
>  ________________________________
>  Explore your hobbies and interests. Click here to begin.



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org

Re: How to remove selection from a tr:selectManyListBox

Posted by dushyant agarwal <ag...@yahoo.co.in>.
Hi Matthias,
Thanks for the help. It worked. 

Dushyant

Matthias Wessendorf <ma...@apache.org> wrote: Hi

On Wed, Apr 16, 2008 at 7:25 AM, dushyant agarwal
 wrote:
>  Hi,
> Let us suppose that a JSF page consists of a tr:selectManyListBox and a
> tr:commandButton.
> On clicking on an option in the list box that option gets highlighted.
> If press the commandButton then the page simply reloads with the slected
> option in the list still highlighted.
>
> If we want to remove the selection from the list box on submitting the page
> how shall we do it?

If you want to reset the value inside your action method (the one
invoked by the command button), do that inside:

....
UIXEditableValue many = (UIXEditableValue)
FacesContext.getCurrentInstance().getViewRoot().findComponent("IdOfYourManyListboxComponent");
many.resetValue();
....


>
>  ________________________________
>  Explore your hobbies and interests. Click here to begin.



-- 
Matthias Wessendorf

further stuff:
blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
mail: matzew-at-apache-dot-org


       
---------------------------------
 Unlimited freedom, unlimited storage. Get it now