Flash Forms Looping Query

View: New views
1 Messages — Rating Filter:   Alert me  

Flash Forms Looping Query

by stacey plum :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

?Hi boys, I am trying to use the tab navigator to allow editing of a series of forms. All is fine until I get to looping through a query and displaying and updating multiple records.

I think I have to loop the query into a query object, then use the repeater type to display the records.


Then, if using standard cf, I would temporarily append the ids to the field names, send to the action template, strip off, and update the correct records ....help....

FLASH FORM

<cfparam name="url.teacherid" default="1">
<cfparam name="url.lessonid" default="59">

<cfquery name="getmain" datasource="qcadata">
SELECT p_objectiveid, p_objective, p_main, p_activity, p_lessonid, p_teacherid
FROM p_objective
WHERE p_main = yes
AND p_lessonid = #url.lessonid#
AND p_teacherid = #url.teacherid#
</cfquery>

<cfset myq1 = queryNew("p_objectiveid, p_objective, p_activity")>

<cfloop query="getmain">
<cfscript>
Queryaddrow(myq1);
Querysetcell(myq1, "p_objectiveid", #getmain.p_objectiveid#);
Querysetcell(myq1, "p_objective", #getmain.p_objective#);
Querysetcell(myq1, "p_activity", #getmain.p_activity#);
</cfscript>
</cfloop>

<cfform format="flash" action="formdump1.cfm">
<cfformgroup type="tabnavigator">
<cfformgroup type="repeater" query="myq1" label="main">

<cfinput type="text"
name="p_objectiveid_#myq1.p_objectiveid#"
value="#myq1.p_objectiveid#"
bind="{myq1.currentitem.p_objectiveid}">
<cfinput type="text"
name="p_objective_#myq1.p_objectiveid#" value="#myq1.p_objective#"
size="50"
bind="{myq1.currentitem.p_objective}">
<cftextarea type="text"
name="p_activity_#myq1.p_objectiveid#" value="#myq1.p_activity#"
cols="60"
rows="11"
bind="{myq1.currentitem.p_activity}"></cftextarea>
<cfinput type="submit" name="submit" value="submit">

</cfformgroup>
</cfformgroup>
</cfform>


ACTION TEMPLATE

<CFOUTPUT>
<CFLOOP index="p_objectiveid" list="#FORM.p_objectiveid#">
<CFQUERY NAME="updatemo" DATASOURCE="qcadata">
UPDATE p_objective
set p_objective = '#evaluate("FORM.p_objective_#p_objectiveid#"#',
p_activity = '#evaluate("FORM.p_activity_#p_objectiveid#")#'
where p_objectiveid = #p_objectiveid#
</CFQUERY>
</CFLOOP>
</CFOUTPUT>
__________________________________________
Get your own goowy now @ http://www.goowy.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:30:118
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/30
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:30
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.30
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54