RequiredField Validator question

G

Guest

Hi,
I have a TextBox control that needs to have a value only if a drop down box
on the same page has a certain value selected. Is it possible to achieve this
using RequiredFieldValidator for the TextBox and having EnableClientScript =
true (without a post)?

Thank you
 
G

Guest

Hi, although this could be accomplished with Custom Validators, the best
practice is probably to write the javascript validation yourself.

Hope that helps,

Jason Lind
 
G

Guest

I tried to do this with Custom Validators, but it does not fire if the
textbox it validates is empty. So I need to define a RequiredFieldValidator
for the same textbox, but it has to be enabled only if a certain value is
selected in a dropdown list.
 
D

Daniel Walzenbach

Vi,

you certainly can :) You can use ValidatorEnable to enable or disable any
validators on your page.
Basically it vorks like this:

ValidatorEnable(document.getElementById("yourValidator"), false);
or
ValidatorEnable(document.getElementById("yourValidator"), true); // what
a surprise ;-)

HTHs

Daniel Walzenbach
 
G

Guest

Thank you,
That worked.

Daniel Walzenbach said:
Vi,

you certainly can :) You can use ValidatorEnable to enable or disable any
validators on your page.
Basically it vorks like this:

ValidatorEnable(document.getElementById("yourValidator"), false);
or
ValidatorEnable(document.getElementById("yourValidator"), true); // what
a surprise ;-)

HTHs

Daniel Walzenbach
 

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,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top