473,770 Members | 6,348 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieving Label Values froma checkbox list

1 New Member
Hi

I have a checkbox list that I am trying to work through and get the label values for each checked item. I want the values all into one string.

This is what I have
Expand|Select|Wrap|Line Numbers
  1. function GetCheckboxValues
  2. {
  3.  var myCRMString;
  4.  
  5.         for (var n=0; n < document.forms[0].length; n++)
  6.         {
  7.             if (document.forms[0].elements[n].type=='checkbox')
  8.             {
  9.                 if (document.forms[0].elements[n].checked)
  10.                 {
  11.                     myCRMString = myCRMString +" "+ document.forms[0].elements[n].value;
  12.                 }
  13.             }
  14.         }
  15.  
  16.         document.write(myCRMString);
  17. }
  18.  
I know this only returns the value "On" when it runs, can anyone tell me how to get the label value.

Thanks in advance

Angela (New to programming)
Oct 27 '06 #1
1 5382
acoder
16,027 Recognized Expert Moderator MVP
Set the values of the checkboxes to the label values.
May 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
11459
by: Steve | last post by:
I'm not sure if I should be using tables here to structure the layout or if CSS is okay. I have a data entry form in which I have floated the labels to one side, and given them a specific width. With regular input such as textboxes, everything lines up fine. The problem I'm having is that I have an unordered list of checkboxes, and only the first item will line up with the label. The additional checkboxes and their labels end up being...
3
13156
by: TR | last post by:
Is it possible with CSS to prevent this wrapping alignment with a checkbox with a nested label? This is the label of the checkbox that wraps beneath it I'd prefer it looked like this, with a flush left margin:
0
1331
by: Bryan Donaldson | last post by:
I have a table on my web form, declared like this: <asp:table id="tblOverrides" runat="server" enableviewstate=true" cssclass="clsTable"> <asp:tablerow cssclass="clsTblHeader"> <asp:tablecell Text="label" id="hdrLabel"></asp:tablecell"> <asp:tablecell Text="ddl" id="hdrDDL"></asp:tablecell"> </asp:tablerow> </asp:table> -----------------------------------------------------------------------
0
1112
by: mroffey | last post by:
I have a problem where when I click on a checkbox in a datagrid, I want to get the associated label value. here is the code. foreach (DataListItem item in dlCategory.Items) { bool isChecked = ((CheckBox)item.FindControl("chkSelection")).Checked; if (isChecked) { //THIS LINE WORKS AND I CAN HIGHLIGHT THE LABEL
3
3848
by: Mike | last post by:
Need some help with passing a label to a subroutine. I have a form with lots of checkboxes. When the form loads i have a procedure that runs to lookup values and check the appropriate boxes. If the box is checked I want the label to look like a hyperlink. Then the user can click on the label to open a new form that is linked to the checkbox. I had to make labels that were not attached to the checkboxes. If you click a label that is...
10
3701
by: Girish | last post by:
Hi Everyone, I am passing a form to a php script for further processing. I am able to retrieve the last value set for that given form variable using $variable=$_REQUEST;
12
13275
by: vbnewbie | last post by:
I am having problems accessing properties of dynamically generated objects in VB2005. Can someone please help? In a nutshell: My app creates an equal number of checkboxes and labels that share the same Tag number. (I thought it might help) The checkboxes name is a concatenation of "chkCancel" and a number that represents the order in which they were created: chkCancel0 (Tag = 0) chkCancel1 (Tag = 1)
3
1810
by: coolprashh | last post by:
Hi Guys, I hope you can help me out with this .... its really urgent !! I am using PERL as the scripting language and WML as the formatting language as I am working on a WAP application. I have passed variables froma WML form .... the code is as follows .... <?xml version="1.0"?> <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
0
4101
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
0
9591
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
9425
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,...
1
10001
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
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
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3969
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
3573
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2816
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.