The challenge here is that the number of checkboxes are not defined,
meaning the user (to make it simple, let us say a user) can add any
number of checkboxes (20, 40, 50, etc).   This also makes very hard
(=whenever the user wants to add one checkbox, I have to add the
checkbox on the CF page and have to add the column in the database) to
hard-code the checkboxes.

I think that the steps are:

1) I have to develop a CF page where the user can enter the
information for new checkboxes.
2) once the user enters the information, the column in the database
has to be added
3) Also, the checkboxes have to be auto-populated on the CF Page where
the user is going to actually make data entry for forms, categories,
and all other things.


The step 1 and 2 are relatively easy since I simply need to alter the
table, but I am not sure on how to approach the Step 3.

Please let me know if I am missing anything on your tips.

tia


On Apr 10, 2005 10:28 AM, S. Isaac Dealey <[EMAIL PROTECTED]> wrote:
> 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
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202196
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

Reply via email to