473,372 Members | 1,549 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,372 software developers and data experts.

validating multiple groups of checkboxes

Hi,
I have a form that contains multiple groups of checkboxes that act
like radio buttons (at the clients insistance).

There is one text field that is required and 28 checkbox groups.

Here an example of a checkbox group:
<td><input type="checkbox" name="trusted" value="1" id="ck_ttt1"
onclick="...
<td><input type="checkbox" name="trusted" value="2" id="ck_ttt2"
onclick=...

There are 5 more of these "groups"

My mind is mush and I cannot get them to validate, here is what I got:
var count = 0;
for (var i = 0 ; i < form.by.length ; i++) {
if (form.by[i].checked) {count++}
}
if (count == 0) {
alert("You forgot to indicate if you are a peer, direct report,
customer, or other to the assessed.");
return false; // validation failed
} else {
return true; // validation succeded
}
var count = 0;
for (var i = 0 ; i < form.bigpicture.length ; i++) {
if (form.bigpicture[i].checked) {count++}
}
if (count == 0) {
alert("In the Leadership area, you forgot to check the big picture
option.");
return false; // validation failed
} else {
return true; // validation succeded
}

Thanks

Kim

Sep 14 '07 #1
2 6766
forbes said the following on 9/14/2007 3:17 PM:
Hi,
I have a form that contains multiple groups of checkboxes that act
like radio buttons (at the clients insistance).
If you want something that acts, looks and feels like a radio button,
then you use a radio button.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Sep 15 '07 #2
In comp.lang.javascript message <DM********************@giganews.com>,
Fri, 14 Sep 2007 20:46:18, Randy Webb <Hi************@aol.composted:
>forbes said the following on 9/14/2007 3:17 PM:
>I have a form that contains multiple groups of checkboxes that act
like radio buttons (at the clients insistance).

If you want something that acts, looks and feels like a radio button,
then you use a radio button.

AIUI, if one wants to retain the client's business, one heeds the
client's demands, where insistent. IIRC, you have previously indicated
much the same yourself.

But the ideal answer would be to use radio buttons (type=radio) styled
to look like checkboxes.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
<URL:http://www.merlyn.demon.co.uk/TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.merlyn.demon.co.uk/clpb-faq.txt RAH Prins : c.l.p.b mFAQ;
<URL:ftp://garbo.uwasa.fi/pc/link/tsfaqp.zipTimo Salmi's Turbo Pascal FAQ.
Sep 15 '07 #3

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

Similar topics

6
by: Emmett Power | last post by:
Hi, I have a form on a web page with a number of radio buttons bound to the same field. Is it possible to set up the form so that users can select more than one radio button to submit multiple...
8
by: Ralph Freshour | last post by:
I have multiple checkbox's created with an array name because I have many on the same web page - their names are like: frm_chk_delete frm_chk_delete frm_chk_delete frm_chk_delete etc. Here...
5
by: DeMZed | last post by:
Hi, When validating my web site, I've got the following error : ------------------------------ Line 31, column 26: cannot generate system identifier for general entity "PHPSESSID" <a...
5
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: Paul | last post by:
Hi, I'm developing a search facility for my web app. In order for the search criteria to be valid the user must (a) enter some text in a text box and check and least one checkbox (of which there...
3
by: Darrel | last post by:
I noticed this nice new feature in 2.0: a.. Validation Groups - Validation groups allow multiple forms on a page to be separately validated. Alas, I'm using 1.1 on a project at the moment and...
5
by: TechnoAtif | last post by:
Hi All..'mAtif..i've got stuck within checkboxes these days..i've got many input items like checkboxes,textarea and along with them there are many checkboxes...all the data except the checkbox's is...
7
by: mc | last post by:
I've not been able to get a Check box to client side validated on postback. with my changes I can get it to work on the serverside ok but not on the client. I have created a new control as...
0
by: Ned Balzer | last post by:
Hi, Can anyone point me in the direction of a solution for validating multiple checkboxes in an asp.net 2.0 page? 1) This is not a checkboxlist, it is a number of separate checkboxes 2) I do...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.