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

tracking the number of checkboxes selected

rcollins207
what i have to do is make sure that they only select a certain amount of items i have looked everywhere but it must be a simple thing that i cannot think of please any help would be great!! so i think that all i need to do is track the number that is selected when they click submit but i cannot find the answer please help me.


Expand|Select|Wrap|Line Numbers
  1.       <cfinput type="checkbox" name="fill2" value="1" id="fill2"> 
  2.                   Chicken &amp; Salad<br>
  3.                   <cfinput type="checkbox" name="fill2" value="2" id="fill2"> 
  4.                   Egg &amp; lettuce<br>
  5.                   <cfinput type="checkbox" name="fill2" value="3" id="fill2"> 
  6.                   Mediterranean<br>
  7.                   <cfinput type="checkbox" name="fill2" value="4" id="fill2"> 
  8.                   Chicken Caesar<br>
  9.                   <cfinput type="checkbox" name="fill2" value="5" id="fill2">
  10.                   Smoked Salmon &amp; Brie Cheese<br>
  11.                   <cfinput type="checkbox" name="fill2" value="6" id="fill2"> 
  12.                   Ham &amp; Salad<br>
  13.                   <cfinput type="checkbox" name="fill2" value="7" id="fill2"> 
  14.                   Vegetarian<br>
  15.                   <cfinput type="checkbox" name="fill2" value="8" id="fill2"> 
  16.                   Roast Beef</p>
  17.                   </div>
Sep 3 '08 #1

✓ answered by acoder

As I said, it'll be a list, so use listlen on the form variable. Assuming you sent it as a post request, it would be form.fill2:
Expand|Select|Wrap|Line Numbers
  1. <cfif listlen(form.fill2) EQ 4>

5 3803
acoder
16,027 Expert Mod 8TB
The fill2 variable will be a list containing the values of the checked checkboxes. It could be undefined if none are checked, so you should use cfparam to default to the empty string.
Sep 3 '08 #2
thank you for the reply....
i haven't used <cfparam> yet and i will look into it now thank you but what i need to now is how do i make it that they have to select 4 no more no less how do i track how many that they have selected.
what they want is three radio buttons that determines how many fills they want (4,5,6)
and under that i have 8 checkboxes that are the fills but how many that they aloud to be selected depends on the three radiobuttuons
thanks for the help
Sep 3 '08 #3
acoder
16,027 Expert Mod 8TB
As I said, it'll be a list, so use listlen on the form variable. Assuming you sent it as a post request, it would be form.fill2:
Expand|Select|Wrap|Line Numbers
  1. <cfif listlen(form.fill2) EQ 4>
Sep 4 '08 #4
thanks mate that worked :) well
Sep 4 '08 #5
acoder
16,027 Expert Mod 8TB
You're welcome :) Glad it worked.
Sep 5 '08 #6

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

Similar topics

9
by: Gary | last post by:
Hello, Is it possible to dynamically update a textbox with words chosen from a list using form checkboxes and javascript? Gary
3
by: Toboja | last post by:
Hello, I have two select lists: Available Sort Options and Selected Sort Options. The user clicks on any of the available sort options and can move them to the selected sort options box. I use...
3
by: Kyle Friesen via AccessMonster.com | last post by:
Mike, I have databse that creates a "tracking number" based on the selections made on the form via concatenating. At the end of the tracking number, I need a two digit (01-99) sequence number by...
3
by: Mark | last post by:
I am looking for an example of using checkboxes in a repeater control where the checkbox state is persisted from page to page. Thank you, Mark
2
by: Mortar | last post by:
i have a datagrid with 2 columns. the 1st column contains an id which will be used by the database for the selected checkbox records. the 2nd column is a template column containing a server...
1
by: babu17 | last post by:
hi, i have a list of checkboxes, the number of checkboxes is dynamic. All the checkboxes have same name. i am trying to get the length of selected checkboxes. <input type=checkbox name=name1...
11
by: SKBodner | last post by:
Hello, I'm stumped and I'm hoping someone could help me figure out the best way to track daily attendance for the next 6-4 months. I have a list of 80 or so participants who should be attended...
3
by: somaskarthic | last post by:
Hi How to get the values of dynamically created checkboxes which are checked and unchecked (for both the conditions). Only the selected checkbox values are posted as 'On' . How can i get the value...
2
by: leifstarkey | last post by:
Hi all... My problem is I'm trying to make a form containing radio buttons and checkboxes. But on the event that one of the radio buttons is selected i want specific checkboxes to then be...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
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
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.