Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Submit Struts Form with JavaScript

843838Jan 26 2006 — edited Dec 4 2006
I have a JSP page with java script and form as shown below. When I click on the button, the javascript alerts the message "About to submit form" but the form is never submitted. Any ideas why?

Thanks.



<script type="text/javascript">
function validateTheForm ()
{
alert("About to submit form");
document.forms['addUserForm'].submit();
}
</script>

<html:form action="AddUser.do?do=addUser" enctype="multipart/form-data">
<table border=0>
<tr>
<td align=right><strong><font size="2" face="Verdana"><bean:message key="adduser.label.userId"/>:</font></strong></td>
<td align=left><html:text property="userId" maxlength="20"/></td>
<td><html:errors property="userId"/></td>
</tr>
</table>
<br><br>
<html:button property="submit" onclick="javascript:validateTheForm();">Submit</html:button>
</html:form>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 1 2007
Added on Jan 26 2006
6 comments
214 views