You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Joost Schouten <jo...@jsportal.com> on 2007/05/01 10:40:33 UTC
RE: form submit with onchange
Simon,
Thanks, that did the trick for me.
Cheers,
Joost Schouten
-----Original Message-----
From: Simon Kitching [mailto:simon.kitching@rhe.co.nz]
Sent: Monday, April 30, 2007 4:51 PM
To: MyFaces Discussion
Subject: Re: form submit with onchange
Joost Schouten wrote:
> Hi,
>
> I have a selectOneMenu which should trigger a backing bean action with
it's
> onchange. The form has no links or buttons to submit it with. Is there an
> elegant way to set the default action of a form? I read something about
> <j4j:defaultAction> but don't fancy importing additional jar's for just
one
> feature like this. A default action for a form seems desirable behavior to
> me as it would also solve the problem of a user hitting enter on a form in
> stead of clicking a button.
>
> I noticed s:form has an action attribute, but this does not seem to be for
> the purpose I just described.
>
> Is there a standard way to handle a form submit without a commanButton?
>
> Thank you,
> Joost
>
A form does not have an action associated with it. Only command
components (commandButton, commandLink) can execute actions.
However the command component can be invisible (style="display:none"),
and be triggered from javascript.
The necessary script can be written manually (see the myfaces wiki) but
the sandbox s:submitOnEvent tag makes this easier:
http://wiki.apache.org/myfaces/SubmitOnEvent
Regards,
Simon