Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 ChecK all checkboxes when checkboxes have the same name.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-01-17 : 09:02:30
Kenneth writes "I have a program for group emails using ASP, when people check the checkboxes of who they want to email it is then sent and disected to another ASP page and is then sent to Outlook.
This works fine, the problem I am having is I want to setup a button checking all boxes so the person dosen't need to check each individual box. I have seen examples with the use of Javascript where they use an array of names for the checkbox and then they check them but I can not do that becasue then my diagnosis would not work. Reason is it uses only one name for all the input checkbox fields. If you have any examples or pages you could link me to, that would have the answer to this question please feel free to send this to me."

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-01-17 : 09:07:20
Well, this is about as off-topic on SQL Team as you can get! You'll find better info on a JavaScript site, like, maybe, http://www.javascript.com/

Actually, it's not that hard to do if you're using a checkbox array:

function checkAll() {
for(x=0;x<checkboxes.length;x++)
{checkboxes[x].selected=true;}
}


You'd then have your form button like:

<input type=button name=checkall value="Check All" onclick="checkAll();">

Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-01-24 : 00:28:03
You'll want to loop through the
document.form.elements[x] collection/array

document.suggestForm.elements[x].type will tell you if it's a radio button and .name should tell you the name.



Go to Top of Page
   

- Advertisement -