Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
Niles Runeberg #1
Creating database fields from Struct(FORM)
I have a survey that has a few questions which change every month. I am looking
for a way to edit the HTML only and add the relevant FORM variables, and then
have the system do the rest i.e. create the neccasary variables and then submit
the information.
Here is what I have as a script to generate the database fields...
<cfset VARIABLES.dbScript = "create table survey (">
<cfset VARIABLES.firstLoop = "True">
<cfloop list="#structKeyList(FORM)#" index="currentKey">
<cfscript>
if (VARIABLES.firstLoop IS "True")
{
VARIABLES.dbScript = VARIABLES.dbScript &
currentKey & " VARCHAR2(50)";
VARIABLES.firstLoop = "False";
}
else
{
VARIABLES.dbScript = VARIABLES.dbScript & ", " &
currentKey &
" VARCHAR2(50)";
}
</cfscript>
</cfloop>
<cfset VARIABLES.dbScript = VARIABLES.dbScript & ")">
This is supposed tol generate a simple script for building my database (that's
a simplified Oracle syntax) It's horribly inefficient use of storage, but I
want quick and easy so...
Can I use and modify the procedure above to generate an insert statement from
the form variables? This will actually be my action page, whereas step 2 is
just a widget to help you create the table.
Does this make sense? What I am trying to do is build the survey form, then
using the widget I created in step 2 to build a script to create storage for
the form, simply by filling it out and submitting it to the widget. Then I use
the code in step 3 as my action page, and it will stuff the form fields into
your database.
Will this work? Is this a good idea? Any other suggestions?
Niles Runeberg Guest
-
Dynamically creating fields in a flex form
Hello frieds, I am wondering if it would be possible with Flex to dynamically generate a form by quering a small databse that would return via... -
Putting identical form fields into database
I want to add a new entry to my database.. I have the form with all the fields ready. However for one particular field, i want to have a drop... -
Dynamically creating form fields from DB
Hi All I've just been doing a basic Contact Us form and having actually structured it for a change I noticed that a lot of repetitive and could... -
Issues with declaring struct arrays inside of a struct
I have the following C++ code: define MAXXPAXX 64 // Pack sub component of database struct. typedef PREFIX_PACKED struct { DWORD packid;... -
Calling fun taking struct and not pointer to struct?
Robert Feldt wrote: I'm a little confused by the question... are you asking if: 1) The act of using a struct in the declaration of another... -
Niles Runeberg #2
Re: Creating database fields from Struct(FORM)
Should I rephrase the question?
Niles Runeberg Guest



Reply With Quote

