Action Not Being Called When Unchanged Form Submitted
Action Not Being Called When Unchanged Form Submitted
(OP)
I have a struts application that contains JSP pages with
Next, Previous, and Cancel buttons. My Next and Cancel buttons work great. However, I cannot get the Previous button to invoke the action mapping if NO changes have been typed onto the form. There are actually 2 forms on the page. The first form (not seen below) is included in a header.inc....
Here's a snippet of the JSP:
<form name="Step3Form" method="post" action="/awardBuild/EditAwardDataStep3.do">
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="600" height="2" colspan="4"><img src="images/horizontalbar.gif"/></td>
</tr>
<html:submit styleClass="button" property="<%=Constants.COMMAND%>" value="<%=Constants.EDIT_STEP3%>" ></html:submit>
<html:submit styleClass="button" property="<%=Constants.COMMAND%>" value="<%=Constants.PREVIOUS%>" onclick="document.forms[1].submit();"></html:submit>
<html:cancel styleClass="button"></html:cancel >
I can intercept and trace the EDIT_STEP3 and CANCEL. The previous just re-displays the current JSP, while I need it to invoke the action to determine the next screen to display based on the mapping path. Validator is OFF for this JSP.
Any help is greatly appreciated!
Next, Previous, and Cancel buttons. My Next and Cancel buttons work great. However, I cannot get the Previous button to invoke the action mapping if NO changes have been typed onto the form. There are actually 2 forms on the page. The first form (not seen below) is included in a header.inc....
Here's a snippet of the JSP:
<form name="Step3Form" method="post" action="/awardBuild/EditAwardDataStep3.do">
<table border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="600" height="2" colspan="4"><img src="images/horizontalbar.gif"/></td>
</tr>
<html:submit styleClass="button" property="<%=Constants.COMMAND%>" value="<%=Constants.EDIT_STEP3%>" ></html:submit>
<html:submit styleClass="button" property="<%=Constants.COMMAND%>" value="<%=Constants.PREVIOUS%>" onclick="document.forms[1].submit();"></html:submit>
<html:cancel styleClass="button"></html:cancel >
I can intercept and trace the EDIT_STEP3 and CANCEL. The previous just re-displays the current JSP, while I need it to invoke the action to determine the next screen to display based on the mapping path. Validator is OFF for this JSP.
Any help is greatly appreciated!
RE: Action Not Being Called When Unchanged Form Submitted
Does your action differentiate between the two correctly?
Your "previous" button submits forms[1] in the onclick event. Is the html:submit tag for that button inside of forms[1]? It's possible that the wrong form is being submitted.
Try making the "previous" button a "<html:button" tag instead of "<html:submit" and use the onclick event to process the action.
-G