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. 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.
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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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:
-----------------------
|
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. ...
|
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...
|
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?
|
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...
| |
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
|
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...
|
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....
|
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
|
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...
|
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,...
| |
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...
|
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...
|
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...
|
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();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
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...
| |