Problem with client side validators and state

Discussion in 'ASP .Net' started by just.an.imbecile, Jun 21, 2006.

  1. Hello all,
    Here is a quick version of my problem. I have a website that
    consists of 4 ASPX pages. Every field is required by default, but on
    pages 1 and 2, there are several fields that can be disabled based on
    answers to questions. (Ex. If they have been at their current address
    for over two years, then they are not required to fill out the previous
    address information). It all works great, except that when I go back to
    page 1 from page 2, I have to re-answer the questions that disable
    validation all over again. (Ex. I say I have been at my current address
    for 5 years and click next to go to page 2. Then I click previous to go
    back to page 1. I am forced to answer the question again because
    previous address has become required again).

    I have determined that my server side code to conditionally turn off
    validators works perfectly. The problem is in my client side javascript
    code.

    I tried adding calls to the javascript code that turns off
    validators every time that someone clicks next and previous. This
    worked fine, except that none of the rest of the validators worked
    untill the user either filled out the conditionally required fields, or
    answered the condition questions to make them all not required. (Ex. If
    I asked for their name and current and previous address info, it would
    tell me that the previous address info is required, but not their name
    or current address. Then, if I filled out the previous address, or said
    I had been at my current address over 2 years, it would finally tell me
    that current address and their name are required).

    Sorry if this is long, but I hope it is at least clear. Does anyone
    have any ideas as to how to either:
    a) Validate everything and still call my javascript to check the
    conditional required statements

    or

    b) Persist the Client Side status of the validators from page to
    page?

    Please let me know if anything needs clarification, and thanks in
    advance for any help.
    just.an.imbecile, Jun 21, 2006
    #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. Ratman
    Replies:
    0
    Views:
    644
    Ratman
    Sep 14, 2004
  2. Mike Surcouf

    Validators and client side script

    Mike Surcouf, Jan 27, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    2,011
    Mike Surcouf
    Jan 27, 2006
  3. Stuart Whiteford
    Replies:
    2
    Views:
    737
    Stuart Whiteford
    Apr 25, 2006
  4. Nathan Sokalski
    Replies:
    4
    Views:
    4,455
    Nathan Sokalski
    Feb 11, 2008
  5. Nathan Sokalski

    Client-Side Validation with Validators and JavaScript

    Nathan Sokalski, Feb 11, 2008, in forum: ASP .Net Building Controls
    Replies:
    4
    Views:
    910
    Nathan Sokalski
    Feb 11, 2008
Loading...

Share This Page