473,503 Members | 1,787 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

RequiredField Validator question

Vi
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
Nov 19 '05 #1
4 1179
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

"Vi" wrote:
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

Nov 19 '05 #2
Vi
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.

"Jason L Lind" wrote:
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

"Vi" wrote:
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

Nov 19 '05 #3
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("yourValid ator"), false);
or
ValidatorEnable(document.getElementById("yourValid ator"), true); // what
a surprise ;-)

HTHs

Daniel Walzenbach
"Vi" <Vi@discussions.microsoft.com> schrieb im Newsbeitrag
news:15**********************************@microsof t.com...
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

Nov 19 '05 #4
Vi
Thank you,
That worked.

"Daniel Walzenbach" wrote:
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("yourValid ator"), false);
or
ValidatorEnable(document.getElementById("yourValid ator"), true); // what
a surprise ;-)

HTHs

Daniel Walzenbach
"Vi" <Vi@discussions.microsoft.com> schrieb im Newsbeitrag
news:15**********************************@microsof t.com...
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


Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
3122
by: Nick Kew | last post by:
There's a new beta of the W3C Markup Validation Service now live at <URL:http://validator.w3.org:8001/> Probably the most important change is verbose output, including attempts to explain the...
195
8315
by: Torbjørn Pettersen | last post by:
As you might have noticed I'm trying to clean up my web site's HTML code. The way I do it is simply more or less redoing to complete site, testing it on a web server I have set up on my local...
13
10779
by: Niki Kovacs | last post by:
Hi, I'm an Austrian writer living in Montpezat (South France). I just installed a local W3C validator on my machine (Slackware 10.1, local Apache server). It's accessible as...
2
2443
by: Sean | last post by:
Hi, I have 2 buttons A and B, textbox C and dropdown list D. When A is clicked, C is required field. When B is clicked, C and D are required fields. There is a dummy entry "please select" in the...
0
7931
by: Bryce Budd | last post by:
Hello All, I've been a taker of information from newsgroups for a long time and thought I'd finally make a contribution back to the community whose supported me when I've needed it. After all...
5
2438
by: Richard Payne | last post by:
Hi This is probably a newbie question but I can't seem to find a clear answer to the problem I have. I have created a Custom Validator control on my webform that works fine, but when I put...
4
1377
by: venky | last post by:
I have a question. I have two requiredfield indicators in my asp.net page and i have two buttons like getnextlead and getcustomer. I want the first requiredfieldindicator to be on for...
40
5535
by: VK | last post by:
Hi, After the response on my request from W3C I'm still unclear about Tidy vs. Validator discrepansies. That started with <IFRAME> issue, but there is more as I know. Anyway, this very basic...
0
1093
by: =?Utf-8?B?QWJieQ==?= | last post by:
I have one form on the page but have multiple submit buttons for different elements. When clicking on a button not associated with the required elements the validator popup still comes up. How...
37
3618
by: Prisoner at War | last post by:
Actually, it doesn't have to be a blockquote...but I'm at my wits' end: I want to make bold several lines of text which have a pair of <br /tags between them...seems like the <b></bdo not "carry...
0
7199
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7074
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7322
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6982
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5572
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.