Validators

C

Chuck Douglas

I am using a CompareValidator to make sure the content in a textbox control
is an integer. I am also using a RangeValidator to make sure the number is
between a certain range.

When the user types an alphanumeric string (i.e. "A67"), both validators
fire. I understand why the CompareValidator fires. Why does the
RangeValidator fire?

In this case, I do not want to see both errors. Is there anyway to have the
second through n validators not get evaluated, if the first validator failed?
Are there other options I should be considering?

Thanks
Chuck
 
G

Gregory A. Beamer

Chuck Douglas said:
I am using a CompareValidator to make sure the content in a textbox
control
is an integer. I am also using a RangeValidator to make sure the number
is
between a certain range.

When the user types an alphanumeric string (i.e. "A67"), both validators
fire. I understand why the CompareValidator fires. Why does the
RangeValidator fire?

Both are evaluated on the control, and both fail, so both fire.

BTW, you can set up JavaScript on the control in question that intercepts
the key presses and only allows numbers. This will give you the potential of
not having a compare validator on the control, thus getting rid of the
second message.
In this case, I do not want to see both errors. Is there anyway to have
the
second through n validators not get evaluated, if the first validator
failed?
Are there other options I should be considering?

Other than the above, you also have the ability of creating a custom
validator that watches both conditions.

--
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
| Think outside the box! |
************************************************
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top