You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dave <ja...@yahoo.com> on 2006/08/25 12:06:12 UTC
how to submit a form and execute action when pressing RETURN
<h:form>
<h:panelGrid columns="3" >
<h:outputText value="Name "/>
<h:inputText value="#{bean.name}"/>
<h:commandButton value="Submit"
action="#{bean.changeName}"/>
</h:panelGrid>
</h:form>
It is working fine if pressing the command button. But if I input a name and press RETURN key, the form seems submitted, but the action method is not executed. It is nice to allow user to input a name and press RETURN without pressing the button. How? Thanks!
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.
Re: how to submit a form and execute action when pressing RETURN
Posted by Jeff Bischoff <jb...@klkurz.com>.
Dave,
This was discussed before. You can read about it in the mailing-list
archives. [1]
This topic is covered on the Wiki [2]. I am using the solution from
there, and it works. (Both the commandButton and commandLink versions)
[1] http://www.mail-archive.com/users@myfaces.apache.org/msg20465.html
[2] http://wiki.apache.org/myfaces/SubmitPageOnValueChange
* You should check both of the above locations for answers before
posting on this list. :)
Regards,
Jeff Bischoff
Kenneth L Kurz & Associates, Inc.
Dave wrote:
>
> <h:form>
> <h:panelGrid columns="3" >
> <h:outputText value="Name "/>
> <h:inputText value="#{bean.name}"/>
> <h:commandButton value="Submit"
> action="#{bean.changeName}"/>
> </h:panelGrid>
> </h:form>
>
> It is working fine if pressing the command button. But if I input a
> name and press RETURN key, the form seems submitted, but the action
> method is not executed. It is nice to allow user to input a name and
> press RETURN without pressing the button. How? Thanks!
>
>
>
> ------------------------------------------------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls
> <http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/evt=39663/*http://voice.yahoo.com>
> to the US (and 30+ countries) for 2¢/min or less.