mkowalski68
asked on
enterkey
I have a form using Struts and Jstl. My form on submit calls a struts action that reads the form and
detrmines which button is pressed and then acts accordingly. This works great but a user pushes the enter key the action is called but
does not know which button was pressed. Is there a way I can send in the attribute of the button when the enter key is pressed?
the form and button are below.
<ssl:form action="/loginAction.do" onsubmit="return validateLoginForm(document .loginForm )">
<td><img src="img/login_text.gif" border="0" alt=""><img src="img/clear.gif" width="5" height="10" border="0" alt=""></td>
<td>
<html:text property="email" value="Email Address"
onfocus="clearInputBox(doc ument.logi nForm.emai l, 'Email Address')"
maxlength="50" styleClass="blue_border"/>
</td>
<td><html:image property="loginButton" src="img/buttons/header_lo gin_button .gif"
onmouseover="MM_swapImage( 'loginButt on','','im g/buttons/ header_log in_button_ over.gif', 1)"
onmouseout="MM_swapImgRest ore()"
alt="Login" border="0"/></td>
</ssl:form>
detrmines which button is pressed and then acts accordingly. This works great but a user pushes the enter key the action is called but
does not know which button was pressed. Is there a way I can send in the attribute of the button when the enter key is pressed?
the form and button are below.
<ssl:form action="/loginAction.do" onsubmit="return validateLoginForm(document
<td><img src="img/login_text.gif" border="0" alt=""><img src="img/clear.gif" width="5" height="10" border="0" alt=""></td>
<td>
<html:text property="email" value="Email Address"
onfocus="clearInputBox(doc
maxlength="50" styleClass="blue_border"/>
</td>
<td><html:image property="loginButton" src="img/buttons/header_lo
onmouseover="MM_swapImage(
onmouseout="MM_swapImgRest
alt="Login" border="0"/></td>
</ssl:form>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> Best way
I'd argue that it's the "best" way...
Pressing return is the accepted standard for submitting forms via the default post method, and disabling it will make your website less accessible to disabled users, etc...
I'd argue that it's the "best" way...
Pressing return is the accepted standard for submitting forms via the default post method, and disabling it will make your website less accessible to disabled users, etc...
https://www.experts-exchange.com/questions/21033013/Disable-Enter-key-for-Both-Netscape-4-and-IE-6.html#11363894