I want to create a form full of checkboxes. The checkboxes are displayed in a table format: 2 colums for each row as shown below.
I have upwards of 80 items to be displayed as checkboxes, and their values are always changing. I want them to be displayed alphabetically, but I don't want to hard code them because if one in the middle changes I have to change all of them (their positions).
I have created a CF list where I can add to, remove or change the list items regardless of their alphabetical position, then have it sort the list:
What I want to do now is output the list so that it creates a form that looks like this:
I can't figure out how to dynamically code the <tr> and <td> tags so that it displays this way. What I get is:
Thanks for your help in advance!!
Code:
<tr>
<td><input type="Checkbox" name="fruit" value="banana"> banana</td>
<td><input type="Checkbox" name="fruit" value="mango"> mango</td>
</tr>
I have created a CF list where I can add to, remove or change the list items regardless of their alphabetical position, then have it sort the list:
Code:
<cfset mylist = "">
<cfset mylist = ListAppend(mylist,"banana")>
<cfset mylist = ListAppend(mylist,"strawberry")>
<cfset mylist = ListAppend(mylist,"pear")>
<cfset mylist = ListAppend(mylist,"mango")>
<cfset mylist = ListSort(mylist,"textnocase","asc")>
Code:
O banana O mango
O pear O strawberry
Code:
O banana
O mango
O pear
O strawberry