To avoid wheel reuse, I create the form using the CakePHP form helper, which creates the following markup:
<div class="input select"><label for="ReportFruit">Fruit</label> <input type="hidden" name="data[Report][Fruit]" value="" id="ReportFruit" /> <div class="checkbox"><input type="checkbox" name="data[Report][Fruit][]" value="0" id="ReportFruit0" /><label for="ReportFruit0">Banana</label></div> <div class="checkbox"><input type="checkbox" name="data[Report][Fruit][]" value="1" id="ReportFruit1" /><label for="ReportFruit1">Apple</label></div> <div class="checkbox"><input type="checkbox" name="data[Report][Fruit][]" value="2" id="ReportFruit2" /><label for="ReportFruit2">Pear</label> ... </div> </div>β
What generates a bunch of flags in this format:
[] Banana [] Apple [] Pear [] ...
I would like to format them so that they display like this: (ideally, I could still set the number of options per line, but if that is also not very good)
[] Banana [] Apple [] Pear [] Mango [] Lemon [] ...
Can I only do this with CSS, or will I need to manipulate the DOM with JS (or change the markup from PHP to its output)?
source share