Interdependent validation

A

antonyliu2002

I have a page that looks like this:

___txtbx1_____ [chkGT]< Your GPA [chkLT]< __txtbx2____


I am trying to implement user data validation.

None of the four controls is required. But I want to validate user
input according to the following logic.

1. If txtbx1 is filled, then it must pass a RangeValidator.
2. If txtbx1 is valid, then chkGT (i.e., checkbox Greater Than) must be
checked.
3. If chkGT is checked, then txtbx1 must be filled and be valid.

4. Similarly, if txtbx2 is filled, then it must pass a RangeValidator.
5. If txtbx2 is valid, then chkLT (i.e., checkbox Less Than) must be
checked.
6. If chkLT is checked, then txtbx2 must be filled and be valid.

7. If both txtbx1 and txtbx2 are valid, then both checkGT and chkLT
must be checked.
8. Vice versa, if both chkGT and chkLT are checked then both txtbx1 and
txtbx2 must be filled and be valid.

This sounds very scary to me. It sounds like it is a recursive check.
Is this logic implementable and how? Thanks.
 
G

Guest

my guess is it would be easier to create a custom javascript function to do
all these checks and call it on OnClick client side event on the submit
button.. All the javascript function will need is few 'if' statements which
would make these comparisons, if check fails display an alert and exit .. if
the check passes continue to next check... (you could try to use
RangeValidator and enable disable it with ValidatorEnable fucntion)

And looks to me it wouldnt need any 'recursive check' ... some of the steps
are repeating. for eg 'txtbx1 is valid, then chkGT ' is in both step 2 & 7..
 
A

antonyliu2002

Hi, thank you very much for this nice idea. I can probably use the
same idea for server-side validation, which is my preference.

Sreejith said:
my guess is it would be easier to create a custom javascript function to do
all these checks and call it on OnClick client side event on the submit
button.. All the javascript function will need is few 'if' statements which
would make these comparisons, if check fails display an alert and exit .. if
the check passes continue to next check... (you could try to use
RangeValidator and enable disable it with ValidatorEnable fucntion)

And looks to me it wouldnt need any 'recursive check' ... some of the steps
are repeating. for eg 'txtbx1 is valid, then chkGT ' is in both step 2 & 7..



I have a page that looks like this:

___txtbx1_____ [chkGT]< Your GPA [chkLT]< __txtbx2____


I am trying to implement user data validation.

None of the four controls is required. But I want to validate user
input according to the following logic.

1. If txtbx1 is filled, then it must pass a RangeValidator.
2. If txtbx1 is valid, then chkGT (i.e., checkbox Greater Than) must be
checked.
3. If chkGT is checked, then txtbx1 must be filled and be valid.

4. Similarly, if txtbx2 is filled, then it must pass a RangeValidator.
5. If txtbx2 is valid, then chkLT (i.e., checkbox Less Than) must be
checked.
6. If chkLT is checked, then txtbx2 must be filled and be valid.

7. If both txtbx1 and txtbx2 are valid, then both checkGT and chkLT
must be checked.
8. Vice versa, if both chkGT and chkLT are checked then both txtbx1 and
txtbx2 must be filled and be valid.

This sounds very scary to me. It sounds like it is a recursive check.
Is this logic implementable and how? Thanks.
 

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,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top