473,655 Members | 3,114 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help: Requiredfield validator

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 dropdown list. When B is clicked, D
can't be the dummy option.

I wonder what is the best practice for this case? I was thinking to use
server-side validation for these controls, and created 2 RequiredField
Validators and set them TRUE at designer. Is there anybody who can enlighten
me? Thanks.

Nov 17 '05 #1
2 2457
Sean:

I would use a CustomValidator for this. Using JavaScript its really easy to
detect if the first item in the dropdown box is selected.

Something like:

function isFirstPicked()
{
if (document.formn ame.dropdownlis tname.selectedI ndex == 0)
{
return false;
}
}

tie the function into your CustomValidator and you should be good to go.

HTH
--
Elliot M. Rodriguez, MCSD
*** It would take 227 cans of Mountain Dew to kill me***

"Sean" <ss****@yahoo.c om> wrote in message
news:OF******** ********@TK2MSF TNGP09.phx.gbl. ..
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 dropdown list. When B is clicked, D can't be the dummy option.

I wonder what is the best practice for this case? I was thinking to use
server-side validation for these controls, and created 2 RequiredField
Validators and set them TRUE at designer. Is there anybody who can enlighten me? Thanks.

Nov 17 '05 #2
I got the idea. Thank you.

"Elliot Rodriguez" <el************ **@hotspammyspa mmail.com> wrote in message
news:#u******** ******@TK2MSFTN GP10.phx.gbl...
Sean:

I would use a CustomValidator for this. Using JavaScript its really easy to detect if the first item in the dropdown box is selected.

Something like:

function isFirstPicked()
{
if (document.formn ame.dropdownlis tname.selectedI ndex == 0)
{
return false;
}
}

tie the function into your CustomValidator and you should be good to go.

HTH
--
Elliot M. Rodriguez, MCSD
*** It would take 227 cans of Mountain Dew to kill me***

"Sean" <ss****@yahoo.c om> wrote in message
news:OF******** ********@TK2MSF TNGP09.phx.gbl. ..
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 dropdown list. When B is

clicked, D
can't be the dummy option.

I wonder what is the best practice for this case? I was thinking to use
server-side validation for these controls, and created 2 RequiredField
Validators and set them TRUE at designer. Is there anybody who can

enlighten
me? Thanks.


Nov 17 '05 #3

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

Similar topics

2
2515
by: Quansheng Liang | last post by:
Hello, I struggled with the problem of "undefined reference to `vtable ...`" while migrating a project from windows to linux. After searching the google I removed all the inline functions and now the link errors decreased from over 200 to 5. A great step! But one of my class derived from wxValidator can't be linked correctly though there is no any inline function in it. The error message: -----------------------
0
7943
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 before commercialization took over that was the beauty of the Internet! I've create a checkboxlist validator control...something MS should have done originally in my opinion, but nonetheless here it is. It's a C# control, sort of IE specific. ...
0
1621
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the user couldn't fix an error if they had an error. So I added another sub and fixed the panels, but the compare validator still doesn't work right. Right now the validator pops up with the error that the two values (txtAcctAmtSum and txtInvAmt) are...
4
1387
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 getnextleadbutton but not for getcustomer button and second indicator active for getcustomer button but not for getnextleadbutton. can anyone tell me how to do this?
2
1381
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 dropdown list. When B is clicked, D can't be the dummy option. I wonder what is the best practice for this case? I was thinking to use server-side validation for these controls, and created 2 RequiredField Validators and set them TRUE at...
5
2922
by: Mattyw | last post by:
Hi, I'm relatively new to Web Forms, I have been using Required Field Validators and Regular Expression Validators on a Web Form I am developing and everything works as expected using Visual Studio.NET 2003 and VB code behind. I have a radio button and textbox, and basically i need the textbox to be required based on the user selecting "Yes" from the radio button. I've read through the newsgroups and found that a Custom Validator
2
4533
by: Mike Collins | last post by:
I have a form where I create dynamic controls at runtime. With this, I am adding a dynamic required field validator to each control as needed, but the validators are not firing when I click submit. The submit button was placed at design time and its causesvalidation property is set to true. Can someone tell me if something is missing from my code? Thank you. 1. Code to add dynamic control works fine and I get the Id of the textbox...
36
3095
by: aljamala | last post by:
Hi, I keep getting this warning on a page, but I do not know what the problem is...does anyone have an idea about what could be wrong? line 88 column 7 - Warning: missing </formbefore <td> it highlights this line: <form name="frmCurrency" action="" method="post"> Page source....
0
1104
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 can I disable requiredfieldvalidator fields when I click on non associated button? NOTE:am doing this in asp.net 1.1
0
8380
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8598
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1598
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.