 | 
September 3rd, 2008, 07:57 AM
|  | Newbie | | Join Date: Sep 2008
Posts: 4
| | tracking the number of checkboxes selected
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. - <cfinput type="checkbox" name="fill2" value="1" id="fill2">
-
Chicken & Salad<br>
-
<cfinput type="checkbox" name="fill2" value="2" id="fill2">
-
Egg & lettuce<br>
-
<cfinput type="checkbox" name="fill2" value="3" id="fill2">
-
Mediterranean<br>
-
<cfinput type="checkbox" name="fill2" value="4" id="fill2">
-
Chicken Caesar<br>
-
<cfinput type="checkbox" name="fill2" value="5" id="fill2">
-
Smoked Salmon & Brie Cheese<br>
-
<cfinput type="checkbox" name="fill2" value="6" id="fill2">
-
Ham & Salad<br>
-
<cfinput type="checkbox" name="fill2" value="7" id="fill2">
-
Vegetarian<br>
-
<cfinput type="checkbox" name="fill2" value="8" id="fill2">
-
Roast Beef</p>
-
</div>
Last edited by acoder; September 3rd, 2008 at 11:58 AM.
Reason: Added [code] tags
| 
September 3rd, 2008, 12:03 PM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,963
| |
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.
| 
September 4th, 2008, 12:05 AM
|  | Newbie | | Join Date: Sep 2008
Posts: 4
| |
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
| 
September 4th, 2008, 11:15 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,963
| |
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: - <cfif listlen(form.fill2) EQ 4>
| 
September 5th, 2008, 12:09 AM
|  | Newbie | | Join Date: Sep 2008
Posts: 4
| |
thanks mate that worked :) well
| 
September 5th, 2008, 11:31 AM
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 12,963
| |
You're welcome :) Glad it worked.
|  | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 204,687 network members.
|