Hope this isn't a stupid question, but how do I get the component (given the
id)
in the action method? I couldn't find a method in FacesContext, etc.

-----Original Message-----
From: Mike Kienenberger [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 01, 2006 3:36 PM
To: MyFaces Discussion
Subject: Re: immediate action for non commands

Use immediate="true" on your pulldown as well.
Then you should have access to the converted value in
component.getValue() [it might be component.getLocalValue() -- I can't
remember right now].



On 3/1/06, Lance Frohman <[EMAIL PROTECTED]> wrote:
> Thanks,
>  In the action, how do I tell which option of the select was clicked 
> on (I am using immediate="true")?
>
>
> -----Original Message-----
> From: Dennis Byrne [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, February 28, 2006 7:41 PM
> To: MyFaces Discussion
> Subject: Re: immediate action for non commands
>
> The kludge you speak of is the most popular way to do this.
>
> One warning.  Let's say you have two controls, selectOneMenu and
inputText.
> Your requirement is that the inputText is to be rendered *only* when a 
> certain item (let's call it 'ITEM X') in the selectOneMenu is 
> selected.  You accomplish this by hooking a js event hander into 
> @onclick or @onchange of the selectOneMenu.  The js clicks a hidden 
> commandButton and the form is submitted.  In the action or 
> actionListener of the commandButton, you dynamically render the inputText
element and the form is then rerendered.
>
> If the user clicks then back button, on both IE and FireFox at least, 
> the browser will not go back to the server.  It will simple display 
> the first page in the state it was in just *before* the form was 
> submitted.  There are two important parts to keep in mind.  First, the 
> selected item of the selectOneMenu was 'ITEM X'.  Second, the 
> inputText field was *not* rendered when the form was submitted.  The 
> user will have then effectivly placed the form into a state that is
against the initial requirement.
>
> Dennis Byrne
>
> >-----Original Message-----
> >From: Lance Frohman [mailto:[EMAIL PROTECTED]
> >Sent: Tuesday, February 28, 2006 08:57 PM
> >To: ''MyFaces Discussion''
> >Subject: immediate action for non commands
> >
> >What is the "best practice" if I need a drop down list - 
> ><h:selectOneListbox> - change to go to the server, as if there was an 
> >immediate="true" on a command button.
> >Depending on what is selected in the <h:selectOneListbox>, the page 
> >will be displayed differently.
> >I was using a kludge with onclick="" submitting a <h:commandButton 
> >style="visibility:hidden;" ...>
> >
> >Thanks,
> >Lance
> >
> >
>
>
>

Reply via email to