Welcome Guest, Not a member yet? Register   Sign In
Checkboxes, i have no clue...
#8

[eluser]heat23[/eluser]
The solution depends on where you want to catch that condition
1) If you want to prevent them from physically clicking on boxes after they have done 4, you will need to use the onClick attribute for each checkbox and have a Javascript function that iterates through all the checkboxes on the form and count the number of ones that are checked. If it detects there are 4 checked, throw an alert() to the user

2) If you want them to be able to check as many as they want, but catch it when they hit the submit button, put the onClick() on the button itself

3) If you want to bypass Javascript altogether, you can check for this condition after the form has been submitted. In PHP just do a sizeof($this->input->post('cb')) and if it equal to more than 4, throw an error message

Btw: My Javascript skills aren't good enough to help you out with this solution, otherwise I would have.


Messages In This Thread
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 07:54 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 08:00 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 08:30 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 08:35 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 09:37 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 09:44 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 09:48 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 10:01 AM
Checkboxes, i have no clue... - by El Forum - 07-10-2009, 10:36 AM
Checkboxes, i have no clue... - by El Forum - 08-25-2009, 04:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB