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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Different validations for the same input page

Status
Not open for further replies.

yankee007

Programmer
Oct 12, 2005
1
AT
Hello everybody!

I would like to submit form data to two different actions with different validation:
e.g. input data: liters

After pushing button "Submit" it is checked if liters has been entered and if it is a number
On the same page there is another button "Reject" that only checks if liters has been entered.
If the validation was not successful the entered data should be shown again in the form.

I created two actions "Submit.do" and "Reject.do" and assigned them form beans "Submit" and "Reject" in struts-config.xml. In validation.xml I defined the different validations for the form beans.
Each button calls a javascript that changes the form action to "Submit.do" or "Reject.do"

The problem now is that when I press "Reject" and validation is not successful the entered value for liters is not shown in the form. I found out that this is because in the JSP I defined <form action="Submit.do">. When I change it to "Reject.do" the input is not shown after pushing "Save".

Is there another way to achieve the wanted result? Any help would be appreciated.

Kind regards,
Stefan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top