You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Nazar Stasiv <ns...@yahoo.com> on 2006/04/10 17:39:42 UTC
tobago selectOne onchange attribute
Hello all,
which is the right way to call bean action method with selectOne
onchange attribute. It is stated that onchange references javascript
method to call when value of component changes.
I've got this for jsf code
<tx:selectOneChoice id="instances_apply_filter"
action="#{instances.filterChange}" value="#{instances.currentFilter}"
label="Select" onchange="invokeAction('instances_apply_filter')" >
<f:selectItems value="#{instances.definedFilters}"/>
</tx:selectOneChoice>
and this for invokeAction javascript function included in .js file
function invokeAction(actionComponentId) {
Tobago.submitAction(actionComponentId);
}
But this won't work as action attribute is invalid for
tx:selectOneChoice component
or this message javax.servlet.jsp.JspException Component
instances_apply_filter is no ActionSource
if added <f:actionListener type="#{instances.filterChange}"/> child
element to tx:selectOneChoice
Page should update automatically when value changes.Any ideas ?
Is there "fake" component, not visible to user, to call its action ?
Thank You
Nazar
Re: tobago selectOne onchange attribute
Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi Nazar,
yes some ideas :-), we had a simular problem last week.
If you need a action method executed on server you can add a invisible
tc:link element.
If you don't need to execute a action, just rerender the page you can
use the id of the tx:selectOneChoice in Tobago.submitAction(). (Only
with latest sources, i fixed this in UIPage last friday)
But you need the *full* generated html id, e.g including the id of page
tag, not just the 'instances_apply_filter'.
You can render (nearly) invisible tc:link with this:
<tc:link action="#{instances.filterChange}" id="filterChange" />
if your page contains a empty tc:cell just render this into, or add it
somewhere to a panel and set layout for this cell to '1px' (this is what
i mean with nearly invisible, you can't see the link but it needs
additional 1px space)
Than you can invoke Tobago.submitAction('<pageid>:filterChange') to
execute this action on server.
Hope this helps.
Regards,
Volker
Nazar Stasiv wrote:
> Hello all,
>
> which is the right way to call bean action method with selectOne
> onchange attribute. It is stated that onchange references javascript
> method to call when value of component changes.
>
> I've got this for jsf code
>
> <tx:selectOneChoice id="instances_apply_filter"
> action="#{instances.filterChange}" value="#{instances.currentFilter}"
> label="Select" onchange="invokeAction('instances_apply_filter')" >
> <f:selectItems value="#{instances.definedFilters}"/>
> </tx:selectOneChoice>
>
> and this for invokeAction javascript function included in .js file
> function invokeAction(actionComponentId) {
> Tobago.submitAction(actionComponentId);
> }
>
> But this won't work as action attribute is invalid for
> tx:selectOneChoice component
>
> or this message javax.servlet.jsp.JspException Component
> instances_apply_filter is no ActionSource
> if added <f:actionListener type="#{instances.filterChange}"/> child
> element to tx:selectOneChoice
>
> Page should update automatically when value changes.Any ideas ?
>
> Is there "fake" component, not visible to user, to call its action ?
>
> Thank You
> Nazar
>
--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.