You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Curley, John" <Jo...@NielsenMedia.com> on 2003/05/09 19:45:56 UTC
key problem with LookupDispatchAction
Hi, All:
I have a form that has text boxes and submit buttons. I am using a
LookupDispatchAction that uses a parameter called "userAction" to map the
appropriate button in the Action class.
<html:form ...>
...
<html:submit styleClass="smButton" property="userAction">
<bean:message key='button.search'/>
</html:submit>
However, if a user has the focus on a text box and hits the <Enter> key.
The following runtime error occurs:
"javax.servlet.ServletException: Request[/emailAssociateAction] does not
contain handler parameter named userAction"
This is because the submit button was not actually mouse clicked on and
instead the <Enter> key was selected.
Can anyone let me know what the preferred way of correcting this is?
Thanks,
John
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
RE: key problem with LookupDispatchAction
Posted by Steve Armstrong <bi...@sympatico.ca>.
Hi,
One simple option is to disable the use of the Enter key to submit the form.
This can be done in JavaScript by a function like the following (disclaimer:
I am not a JavaScript guru by any stretch of the imagination :-)
function noEnterKey() {
// Not necessary for Netscape 4
if (document.layers)
return true;
else
return !(window.event && window.event.keyCode == 13);
}
Then, for each of your text input fields, you'd have something like:
<html:text property="yourproperty" onkeypress="return noEnterKey()"/>
Cheers,
-Steve
-----Original Message-----
From: Curley, John [mailto:John.Curley@NielsenMedia.com]
Sent: Friday, May 09, 2003 1:46 PM
To: 'struts-user@jakarta.apache.org'
Subject: <Enter> key problem with LookupDispatchAction
Hi, All:
I have a form that has text boxes and submit buttons. I am using a
LookupDispatchAction that uses a parameter called "userAction" to map the
appropriate button in the Action class.
<html:form ...>
...
<html:submit styleClass="smButton" property="userAction">
<bean:message key='button.search'/>
</html:submit>
However, if a user has the focus on a text box and hits the <Enter> key.
The following runtime error occurs:
"javax.servlet.ServletException: Request[/emailAssociateAction] does not
contain handler parameter named userAction"
This is because the submit button was not actually mouse clicked on and
instead the <Enter> key was selected.
Can anyone let me know what the preferred way of correcting this is?
Thanks,
John
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org