|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Finding the right FORM field
How is this:Morgan Senkal 05/25/04 01:49 P Just use this instead:Raymond Camden 05/25/04 02:00 P > From: Morgan SenkalPhilip Arnold 05/25/04 02:02 P > WHERE Project_Nm = #StructFind(FORM,Evaluate("SELPROJECT" & issueID))#Ben Doom 05/25/04 02:05 P Maybe like this (if form.idListA contains a list of numbers)Pascal Peters 05/25/04 02:04 P Simple, change this:Semrau Steven Ctr SAF/IE 05/25/04 03:45 P Thanks so much everyone!Morgan Senkal 05/25/04 07:46 P How is this: Evaluate("SELPROJECT" & issueID) (issueID is a variable) Equal to this?: Error resolving parameter SELPROJECTFORM.IDLISTA Here is the whole code: <cfloop index="issueID" list="FORM.idListA"> <cfquery datasource="Tribal_Matrix" name="getProject"> SELECT * FROM v_Project WHERE Project_Nm = #StructFind(FORM,Evaluate("SELPROJECT" & issueID))# </cfquery> </cfloop> Basically I'm looping thru a list of numbers. All the FORM fields have established names with one of these numbers at the end, I'd like to loop thru those field names in groups based on the number at the end. So the one in question above would look like FORM[SELPROJECT45] Perhaps I need an explanation of how Evaluate() works...and variables in loops too. Thanks for any help! Just use this instead: form["selproject" & issueid] example: where Project_Nm = #form["selproject" & issueid]# > From: Morgan Senkal > > <cfloop index="issueID" list="FORM.idListA"> <cfloop index="issueID" list="#FORM.idListA#"> > #StructFind(FORM,Evaluate("SELPROJECT" & issueID))# #form["SELFPROJECT#issueID#"]# Also CFQUERYPARAM!!! > WHERE Project_Nm = #StructFind(FORM,Evaluate("SELPROJECT" & issueID))# > WHERE Project_Nm = #FORM["SELPROJECT" & issueID]# Try that. Should work better. Or should tell you issueID contains the wrong data. --Ben Doom Maybe like this (if form.idListA contains a list of numbers) <cfloop index="issueID" list="#FORM.idListA#"> <cfquery datasource="Tribal_Matrix" name="getProject"> SELECT * FROM v_Project WHERE Project_Nm = #FORM["SELPROJECT" & issueID]# </cfquery> </cfloop> If form.idListA contains the maximum maybe it should be: <cfloop index="issueID" from="1" to="#FORM.idListA#"> <cfquery datasource="Tribal_Matrix" name="getProject"> SELECT * FROM v_Project WHERE Project_Nm = #FORM["SELPROJECT" & issueID]# </cfquery> </cfloop> ----- Excess quoted text cut - see Original Post for more ----- Simple, change this: <cfloop index="issueID" list="FORM.idListA"> to: <cfloop index="issueID" list="#FORM.idListA#"> You just need to identify the list coming from a variable - otherwise it's reading (FORM.idListA) as the actual listing. HTH How is this: Evaluate("SELPROJECT" & issueID) (issueID is a variable) Equal to this?: Error resolving parameter SELPROJECTFORM.IDLISTA Here is the whole code: <cfloop index="issueID" list="FORM.idListA"> <cfquery datasource="Tribal_Matrix" name="getProject"> SELECT * FROM v_Project WHERE Project_Nm = #StructFind(FORM,Evaluate("SELPROJECT" & issueID))# </cfquery> </cfloop> Basically I'm looping thru a list of numbers. All the FORM fields have established names with one of these numbers at the end, I'd like to loop thru those field names in groups based on the number at the end. So the one in question above would look like FORM[SELPROJECT45] Perhaps I need an explanation of how Evaluate() works...and variables in loops too. Thanks for any help! _____ Thanks so much everyone! The solution was a combination of the suggestions offered: Yes, I had to change the #StructFind(FORM,Evaluate("SELPROJECT" & issueID))# to the suggested #FORM["SELPROJECT" & issueID]# The problem with that however, is that's where I had started but it didn't work. So that's when I headed down the evaluate path. But if I returned to my original code and also changed <cfloop index="issueID" list="FORM.idListA"> to <cfloop index="issueID" list="#FORM.idListA#"> Then presto, the whole shebang fires off like a dream :-) You guys rock! I knew it would be something simple. It always is :P
|
May 24, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||