> I have a list of generic features.
>
> And I have a list of features assigned to a specific item.
>
> I want to print out the generic features with checkboxes
> next to them.
>
> If the item in question has been assigned one of the
> features, I would like the checkbox for that feature to be
> checked.
>
> In the input tag for the checkbox, what function should I be
> using to compare the feature_id to the query results?
This has taken me all day, but I think the break at lunch
helped clear things up for me.
After querying the selected features, create an empty
variable (it will eventually hold the list of features):
<cfset variables.selected_features = "">
Using cfoutput, add each of the selected features to the list:
<cfoutput query="q_selected_features">
<cfset variables.selected_features =
listappend(variables.selected_features,#q_selected_features.feature_id#)>
</cfoutput>
If you output variables.selected_features, you'll see a
comma delimited list of feature id's.
While ouputting the complete list of possible features, you
add a cfif statement to the checkboxes:
<input
name="footnote"
type="checkbox"
value=""
<cfif listfind(variables.selected_features, #feature_id#)
IS NOT "0">
checked="checked"
</cfif>
/>
variables.selected_features is our list of currently
selected features. feature_id comes from the full list of
possible features.
This *is* the easy way to solve this, right?
--
Austin
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]