Struts validator, multi-page form, and the page attribute

R

Robert Bowen

I am having serious problems with the Struts Validator using a
multi-page form.

I defined an ActionForm with about 50 fields, called "AllForm". I have
3 JSPs, each with about 15-20 fields, but ALL using the AllForm
ActionForm. The idea behind the page variable for your <form>
definitions in validations.xml, as I understand it, is two-fold:

1. A server-side validation is performed on fields whose page
attribute is LESS THAN or EQUAL TO the hidden "page" field in your
JSP.

2. A client-side validation is performed only on those fields whose
page attribute is EQUAL TO the hidden "page" field in your JSP.

But I can't get it to work! Well, at least the client-side Javascript,
the server-side, for the moment, I am not worried about. I put a
hidden "page" field in my JSP with a value of "1", and the "page"
attribute equal to "1" in a bunch of my fields in the validations.xml.
Looking at the browser source, a bunch of EMPTY Javascript functions
are generated, validateRequired(), validateDate(), etc. NONE are
executed, no validation is performed!

However, if I change the "page" attribute to "0", and leave the hidden
field "1", it works! That's my first problem.

Just as annoying is when you go on to page 2 or of the mult-page form.
The theory is that ONLY the fields in page 2 are validated, assuming
you have the "page" attribute in the validations.xml, and the hidden
"page" field in the JSP with the same value.

But looking at the browser source, Javascript functions are generated
for page 1 fields as well, which of course causes javascript errors on
submit.

Anyone ever gotten client-side validation to work on a multi-page
form?

I am all ears ... Willing to call you "the man" if you can show me
what the heck I am doing wrong!

Thanks a mil,
syg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top