I have a form for which I am using Struts Validation.
I have multiple submit buttons in it. One for Update and one for delete.
I am using the following line to invoke the struts validation
This triggers validation even for the delete button which i want to avoid.
I tried using
But the validation does not work at all in the second case.
Does anyone have any ideas?
Do I have any other options?
You need to use the html:cancel button, whenever you want to avoid validations.
It is very convenient to use since you could put any caption you want on it. It would avoid validation. There is also isCancelled() flage that could be used within the action class, to avoid other activities.
I have changed it to the button.
But still the Validation is triggered.
But I found a workaround. I have called a function for Onclick of the Cancel button. Inthat function if I say form.submit(). The form is being submitted .
But before submission, it does pop up the alert box saying the field is required. When you click OK, it is submitted.
Why is the Validation triggered for the Cancel Button also?