Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Action Not Being Called When Unchanged Form Submitted

Status
Not open for further replies.

vvogler

IS-IT--Management
Oct 21, 2005
1
US
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!
 
Your "previous" button and your "edit_step3" button both use the same property value.

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top