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

Discussion in 'Java' started by Robert Bowen, Feb 18, 2004.

  1. Robert Bowen

    Robert Bowen Guest

    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
    Robert Bowen, Feb 18, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Thielen

    sample struts w/ I18N and validator

    David Thielen, Aug 2, 2003, in forum: Java
    Replies:
    0
    Views:
    447
    David Thielen
    Aug 2, 2003
  2. philoso
    Replies:
    3
    Views:
    461
    James
    Jan 30, 2004
  3. sickness
    Replies:
    0
    Views:
    2,346
    sickness
    May 12, 2006
  4. Replies:
    4
    Views:
    893
    Richter~9.6
    Feb 13, 2007
  5. Replies:
    0
    Views:
    807
Loading...

Share This Page