473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Validation for Checkbox and dropdownlist

I am trying to use the following script to see determine whether a
dropdownlist has a value in it or to see whether a checkbox has been checked.
I don't want the user to be able to do both. In other words I don't want a
user to check a checkbox and choose an item from a drop-down list box. I
want them to do one action or the other.
Here is my script to try and do this but im not sure if my logic is correct
as I get an error no matter what I do. Can someone please help me.

<script language=javascript>
function ValidateDropDownOrCheckBox(sender, args)
{
if ( document.WebForm2.DropDownList1.value ||&&
document.WebForm2.CheckBox1.checked )
{
args.IsValid = true;
return;
}
else
args.IsValid = false;
}
</script>

This is how I refer to this script
<asp:CustomValidator id="cvRepApp" runat="server" Font-Size="Medium"
ErrorMessage="Must enter either or"
ClientValidationFunction="ValidateDropDownOrCheckB ox">*</asp:CustomValidator>

Thanks for any help anyone can give me
Nov 16 '05 #1
0 1114

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

Similar topics

0
by: Stephen | last post by:
Could someone please help me with some validation. I have to write code which checks to see whether a dropdown list is populated with a value or a checkbox is checked. I want the code to run on the...
1
by: Stephen | last post by:
I am trying to use the following script to see determine whether a dropdownlist has a value in it or to see whether a checkbox has been checked. I don't want the user to be able to do both. In...
0
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
0
by: Krish | last post by:
Hello Gurus, Pl. help. I need to validate a control in datagrid based on check box selection. Basically in a datagrid i have checkbox and textbox control for edititemtemplate. If checkbox is...
1
by: Buddy Ackerman | last post by:
I don't know what the problem is. I have a form with several controls that need to be validated, I put a validation group in every form control, every validatoino control, the submit button and...
0
by: Nathan Sokalski | last post by:
I have written a Validator (a class that inherits from the BaseValidator class), and it includes client-side validation functions. The validator is a conditional validator that only validates if a...
1
by: raam | last post by:
Hi, I have ajax tab container with 6 tabs in it. I need to validate each tab contents separately and the validtaion summary must be separate for each tab. i cannot do that only one summary is...
5
by: =?Utf-8?B?Y2hlY2tyYWlzZXJAY29tbXVuaXR5Lm5vc3BhbQ== | last post by:
I have a VS 2008 ASP.NET webform that has a reportview tag on it, accessing an .RLDC report in local report. The columns for the report are essentially: Month Item #1 Item#2 Item#3 ...
1
by: janetb | last post by:
I have a gridview with an update capabilities - a textbox column (roomName), a dropdownlist(orgID), a dropdownlist(roomTypeID),a checkbox column (dialOut), a checkbox column (dialIn). When I try to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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,...
0
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...

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.