I have designed a web application that allows users to enter
a number of records on one form – for example computer
skills. The user can add up to 20 different computer skills.
On another form, the user’s recorded computer skills
are shown as a number of dynamic checkboxes. One computer skill
means the user sees one checkbox. Twenty computer skills means the
user sees 20 checkboxes. I have made a query loop to output these
computer skills and checkboxes. I have also made structure
variables so that the selection of the specific computer skill
checkbox is retained for later use in the web application. If the
user checks any of the checkboxes, on submission of the form, the
structure value is updated from no to yes (and vice versa). This
part is working, and I am happy with it.
The problem I have is that I am unable to find a way to
individually indicate that the specific checkbox value is checked
or not. If the user selects the checkbox, submits the form and
returns to the form, the checkbox should still show as ticked as
the structure value of that checkbox is “yes” (as in
checked=”yes”). As I am using structures, adding
#currentRow# to the structure name inside the loop does not work,
as CF views this as a different structure name that is not
recognised. For example:
<cfloop query=”rsReturnComputerSkills
<cfinput type=”checkbox”
name=”computerSkill#currentRow#”
checked=”#structure.computerSkill##currentRow#”
</cfloop>
Essentially, I cannot place the dynamic structure value into
the checkbox input field.
I thought that using an array may overcome this, but alas I
encounter the same problem.
Is there a way to append #currentRow# to the structure name
or is there another way to achieve the same that I have not thought
of?