troubleshooting Question

Coldfusion 9 form processing bug - needs resolution

Avatar of roger v
roger vFlag for United States of America asked on
ColdFusion Language
12 Comments1 Solution279 ViewsLast Modified:
Hi,
I've been struggling with this chunk of code for a while now. I got it working but then the requirements changed and I modified the code accordingly but it still doesn't save the form fields like it's supposed to. Code attached.

When the page loads up, the form displays all the right values by comparing the inner loop to the outer loop and populating the form variables. But when I save, it only saves a couple of fields but misses the rest of them. Obviously there is a flaw in my code logic in the save function. But I just can't seem to figure it out.
<cfif len(strError) eq 0>
		<cfquery name="qryCheckContacts" datasource="#application.datasource#">
			SELECT	process_id
			FROM	tb_process_role_contact
			WHERE	process_id = <cfqueryparam cfsqltype="cf_sql_numeric" value="#val(url.processid)#">
			AND		process_contact_actv_ind = 'Yes'
		</cfquery>
		<cfif qryCheckContacts.recordcount gt 0>
			<!---<cfinvoke component="xxx.xxxx.xxxxx" method="funcGetExistingContacts" returnvariable="qryAllRoles1">
				<cfinvokeargument name="processid" value="#val(url.processid)#">
				<!---<cfinvokeargument name="scopeval2" value="1">--->
			</cfinvoke>--->
			<cfinvoke component="cfc.xxx.xxxx" method="funcGetExistingRoles" returnvariable="qryAllRoles1">
				<cfinvokeargument name="processid" value="#val(url.processid)#">
				<cfinvokeargument name="scopeval2" value="1">
			</cfinvoke>
			<cfinvoke component="xxx.xxxx.xxxxx" method="funcGetExistingContacts" returnvariable="qryUsers">
				<cfinvokeargument name="processid" value="#val(url.processid)#">
			</cfinvoke>
			<cfloop query="qryAllRoles1">
				<cfloop query="qryUsers">
					<cfset form["rolename_"   & qryAllRoles1.currentRow] = qryAllRoles1.rolename>
					<cfif qryUsers.rolename eq qryAllRoles1.rolename>
						<cfset form["txt_admins_"  & qryAllRoles1.currentRow] = qryUsers.admins>
						<cfset form["txt_approvers_" & qryAllRoles1.currentRow] = qryUsers.approvers>
						<cfset form["txt_escalation_approvers_" & qryAllRoles1.currentRow] = qryUsers.esc_approvers>
						<cfset form["txt_secondlevel_approvers_" & qryAllRoles1.currentRow] = qryUsers.secondlevel_approvers>
						<cfset form["txt_secondlevel_escalation_approvers_" & qryAllRoles1.currentRow] = qryUsers.secondlevel_esc_approvers>
						<cfset form["hRoleNameContactSource_"   & qryAllRoles1.currentRow] = qryUsers.RoleNameContactSource>
					<cfelse>
						<cfset form["txt_admins_"  & qryAllRoles1.currentRow] = "">
						<cfset form["hRoleNameContactSource_"   & qryAllRoles1.currentRow] = "">
						<cfset form["txt_approvers_" & qryAllRoles1.currentRow] = "">
						<cfset form["txt_escalation_approvers_" & qryAllRoles1.currentRow] = "">
						<cfset form["txt_secondlevel_approvers_" & qryAllRoles1.currentRow] = "">
						<cfset form["txt_secondlevel_escalation_approvers_" & qryAllRoles1.currentRow] = "">
						<cfset form["hRoleNameContactSource_"   & qryAllRoles1.currentRow] = "">
					</cfif>
				</cfloop>
			</cfloop>
			<cfset form.recordCount = qryAllRoles1.recordCount>
			
		<cfelse>
			<cfinvoke component="xxx.xxxx.xxxxx" method="funcGetExistingRoles" returnvariable="qryAllRoles2">
				<cfinvokeargument name="processid" value="#val(url.processid)#">
				<cfinvokeargument name="scopeval2" value="1">
			</cfinvoke>
			<cfloop query="qryAllRoles2">
				<cfset form["rolename_"   & qryAllRoles2.currentRow] = qryAllRoles2.rolename>
				<cfset form["txt_admins_"  & qryAllRoles2.currentRow] = "">
				<cfset form["hRoleNameContactSource_"   & qryAllRoles2.currentRow] = "">
				<!---<cfset form["chk_approvers_"   & qryAllRoles2.currentRow] = "">--->
				
				<cfset form["txt_approvers_" & qryAllRoles2.currentRow] = "">
				<cfset form["txt_escalation_approvers_" & qryAllRoles2.currentRow] = "">
				<cfset form["txt_secondlevel_approvers_" & qryAllRoles2.currentRow] = "">
				<cfset form["txt_secondlevel_escalation_approvers_" & qryAllRoles2.currentRow] = "">
			</cfloop>
			<cfset form.recordCount = qryAllRoles2.recordCount>
		</cfif>
	
     <cfelse>
    	<cfset form.recordCount = form.frmtempItemCounter>
   	</cfif>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros