You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/06/21 10:55:13 UTC

selected value and immediate submits

Hi,

 

I asked this question a few months ago but I didn't get an answer. So I
try it again because I have to solve this now.

 

I have a selectOneMenu and a link beside it. When the user clicks the
link I need the selected value in my BackingBean without form
validation. The target of the link is an iframe and I don't want that
the same page with error messages is rendered in this iframe. Therefore
the immediate attribute of the link is set true.

I can't use a ValueChangeListener because this is not called with
immediate submits, right?

 

Can I use an updateActionListener and set the selected value via
javascript (see snippet and the '???')

 

Or is the usage of a component binding for the selectOneMenu the only
working alternative?

 

 

Snippet:                       

<t:selectOneMenu id="documentTypeId" forceId="true" 

     value="#{MyBean.document.attributes['documentTypeId']}">

   <f:selectItems value="#{MyBean.scoredCategories['documentType']}"/>

</t:selectOneMenu>

                        

<h:commandLink action="#{MyBean.switchHighlighting}" immediate="true"
target="zone1">

   <t:updateActionListener property="#{MyBean.selectedDocumentTypeId }"
value="????"/>

   ...

</h:commandLink>

 

Thanks in advance,

Michael


Re: selected value and immediate submits

Posted by Jeff Bischoff <jb...@klkurz.com>.
Michael,

I have the same functionality in my application. (Or rather I used to, 
before I started using subForms ;) I used the following:

<h:commandLink action="#{search.doSearch}" immediate="true">
	<h:graphicImage.../>
</h:commandLink>

<h:selectOneMenu value="#{search.searchOption}"
		 onchange="submit()" immediate="true"
		 valueChangeListener="#{search.updateSearchOption}">
	<f:selectItems.../>
</h:selectOneMenu>


And in updateSearchOption() I have this:

public void updateSearchOption(ValueChangeEvent event) {
	String newOption = (String)event.getNewValue();
	this.setSearchOption(newOption);
	...
	FacesContext context = FacesContext.getCurrentInstance();
	context.renderResponse();
}

Regards,

Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.

Michael Heinen wrote:
> Hi,
> 
>  
> 
> I asked this question a few months ago but I didn’t get an answer. So I 
> try it again because I have to solve this now.
> 
>  
> 
> I have a selectOneMenu and a link beside it. When the user clicks the 
> link I need the selected value in my BackingBean without form 
> validation. The target of the link is an iframe and I don't want that 
> the same page with error messages is rendered in this iframe. Therefore 
> the immediate attribute of the link is set true.
> 
> I can't use a ValueChangeListener because this is not called with 
> immediate submits, right?
> 
>  
> 
> Can I use an updateActionListener and set the selected value via 
> javascript (see snippet and the '???')
> 
>  
> 
> Or is the usage of a component binding for the selectOneMenu the only 
> working alternative?
> 
>  
> 
>  
> 
> Snippet:                      
> 
> <t:selectOneMenu id="documentTypeId" forceId="true"
> 
>      value="#{MyBean.document.attributes['documentTypeId']}">
> 
>    <f:selectItems value="#{MyBean.scoredCategories['documentType']}"/>
> 
> </t:selectOneMenu>
> 
>                        
> 
> <h:commandLink action="#{MyBean.switchHighlighting}" immediate="true" 
> target="zone1">
> 
>    <t:updateActionListener property="#{MyBean.selectedDocumentTypeId }" 
> value="????"/>
> 
>    ...
> 
> </h:commandLink>
> 
>  
> 
> Thanks in advance,
> 
> Michael
> 



Re: selected value and immediate submits

Posted by Cosma Colanicchia <co...@gmail.com>.
I would go with a binding, don't know if there are other ways to do
what you need.

Cosma



2006/6/21, Michael Heinen <mh...@recommind.com>:
>
>
>
>
> Hi,
>
>
>
> I asked this question a few months ago but I didn't get an answer. So I try
> it again because I have to solve this now.
>
>
>
> I have a selectOneMenu and a link beside it. When the user clicks the link I
> need the selected value in my BackingBean without form validation. The
> target of the link is an iframe and I don't want that the same page with
> error messages is rendered in this iframe. Therefore the immediate attribute
> of the link is set true.
>
> I can't use a ValueChangeListener because this is not called with immediate
> submits, right?
>
>
>
> Can I use an updateActionListener and set the selected value via javascript
> (see snippet and the '???')
>
>
>
> Or is the usage of a component binding for the selectOneMenu the only
> working alternative?
>
>
>
>
>
> Snippet:
>
> <t:selectOneMenu id="documentTypeId" forceId="true"
>
>      value="#{MyBean.document.attributes['documentTypeId']}">
>
>    <f:selectItems value="#{MyBean.scoredCategories['documentType']}"/>
>
> </t:selectOneMenu>
>
>
>
> <h:commandLink action="#{MyBean.switchHighlighting}" immediate="true"
> target="zone1">
>
>    <t:updateActionListener property="#{MyBean.selectedDocumentTypeId }"
> value="????"/>
>
>    ...
>
> </h:commandLink>
>
>
>
> Thanks in advance,
>
> Michael