Hiya,
I'm trying to create a query based form which reads it's elements from a
database table, then populates itself. Each input element would have be
dynamically named via the DB query.
Creating the form isn't so bad, but handling the insert query the other side is
becoming a headache. I can't figure out how to recreate the dynamic names of
the form variables and extract their data for insertion into the DB.
If that makes little sense i apologise, but here is an example of what i'm
trying to achieve: (removed "<CF" from tags so this posts)
Query code
*****************************
name="jss"
SELECT SUBCAT
FROM JSS
ORDER BY SUBCAT ASC
Form code
******************************
<tr>output query="jss"><td>#SUBCAT# input type="checkbox" name="#SUBCAT#"
checked="no" value="1"></td>/output></tr>
Form validation & SQL input query code
************************************************
output query="jss">
<cfset hello = "FORM.#SUBCAT#">
<cfif #hello# eq '1'>
query name="insert_details">
INSERT INTO METADATA (ID, KEY, VALUE)
VALUES ('#ID#', '#JSS_SUBCAT#','#hello#')
/query>
</cfif>
/output>
Now obviously at the moment #hello# outputs as "FORM.A1" or whatever the
#SUBCAT# variable held. What I need is a way of re-creating those variable
names outside of the form structure, and then using these variable names to
actually pull the data from the form submission.
Thanks a lot for any help,
H
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion 8 - Build next generation apps
today, with easy PDF and Ajax features - download now
http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:287441
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4