Typically you would have a separate form page where administrative
users can manage the list of categories available on a given form...
In your database you would have a table containing a list of forms and
a table containing a list of categories and a cross-reference table to
show whish categories appear on which forms.
tForm
formid nvarchar(35),
formname nvarchar(100)
tCategory
categoryid nvarchar(35),
categoryname nvarchar(100)
tFormCategory
formid nvarchar(35),
categoryid nvarchar(35),
altcategoryname nvarchar(100)
In the form where your users select their categories you would then
simply query the database for the list of all categories plus the
categories associated with the form they are modifying and display the
series of categories with checkboxes and text fields so they can enter
alternate names:
<cfquery name="rsCategory" ...>
select c.categoryid, c.categoryname, fc.altcategoryname
from tCategory c
left join tFormCategory fc on
(fc.categoryid = c.categoryid and fc.formid = '#varibles.formid#')
</cfquery>
<cfoutput query="rsCategory">
<div>
<input type="checkbox" name="categoryid"
value="#rsCategory.categoryid#"
<cfif len(rsCategory.altcategoryname)>checked</cfif> />
<input type="text" name="altcategoryname_#categoryid#"
value="#htmleditformat(iif(len(rsCategory.altcategoryname),'rscate
gory.altcategoryname','rscategory.categoryname'))#">
</div>
</cfoutput>
When this form is submitted you can then loop over the value of the
categoryid checkbox to see which categories the user selected:
<cfquery>
delete from tFormCategory
where formid = '#variables.formid#'
</cfquery>
<cfparam name="form.categoryid" type="string" default="">
<cfloop index="x" list="#form.categoryid#">
<cfset altcatname = form["altcategoryname_#x#"]>
<cfquery>... check to see if the user modified the name
....</cfquery>
<cfquery>
insert into tFormCategory
(formid,categoryid,altcategoryname)
values ('#variables.formid#','#x#',
<cfqueryparam name="#altcatname#"
null="#yesnoformat(not altcatmodified)#">)
</cfloop>
hth
s. isaac dealey 954.522.6080
new epoch : isn't it time for a change?
add features without fixtures with
the onTap open source framework
http://macromedia.breezecentral.com/p49777853/
http://www.sys-con.com/author/?id=4806
http://www.fusiontap.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202139
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54