Code/# <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"> <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> 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(above) that are the fills but how many that they are aloud to select depends on the three radiobuttuons thanks for the help please if you think that i have gone the wrong way about doing this please tell me how i should, i will accept any solution as i have been looked for a whole day thanks in advance <script type="text/javascript"> function checkTotal() { document.listForm.total.value = ''; var sum = 0; for (i=0;i<document.listForm.choice.length;i++) { if (document.listForm.choice.checked) { sum = sum + parseInt(document.listForm.choice.value); } } document.listForm.total.value = sum; } </script> <form name="listForm"> <input type="checkbox" name="choice" value="2" onchange="checkTotal()"/>2<br/> <input type="checkbox" name="choice" value="5" onchange="checkTotal()"/>5<br/> <input type="checkbox" name="choice" value="10" onchange="checkTotal()"/>10<br/> <input type="checkbox" name="choice" value="20" onchange="checkTotal()"/>20<br/> Total: <input type="text" size="2" name="total" value="0"/> </form> i cannot use this sort of solution i think because the value numbers in my checkboxs will be variables called out of the data base but i am taking it one step at a time. so i think i need to track it with just the onclick without useing the value thanks for helping
What I'd do is set up a form with all the checkboxes,... upon clicking submit to post the form data, write script to count the number of checkboxes selected, 1 for checked, 0 for unchecked. Write a cfif statement to proceed if the sum equals 4. If not four, have a stop with a message for the user to select 4 boxes.