This content has been marked as final. Show 8 replies
Your first paragraph suggests that you may have over-engineered your application. Also, if you use array notation on your formfields you don't need the evaluate function and your code will run faster.
Don't I have to regenerate the form field names though?
If I have over-engineered this problem, can you give me an idea on how you would generate a form from a query result then compare the query returned values with the submitted values, and update accordingly?
The query returns an id, a code and a value. The form field names are the code. When new values are submitted the page compares the values returned by the query to the submitted values.
Regardless, this doesn't help me with getting this data to a template.
Thanks though. I have reworked this code a number of times and will continue to do so.
to generate form fields from a query output?
<cfoutput query="something" >
To read them when the form is submitted (I probably have the syntax wrong here.
<cfloop list'"#form.fieldlist#" index="ii">
<cfif left(form[thename#ii#], 7 is "thename">
Thanks, the fieldnames suggestion helped a lot. I'm still having trouble passing this data to something useful. I've come up with the attached code.
. . . but I keep getting the error &quot;Element data.fieldnames is undefined in a Java object of type class coldfusion.filter.FormScope. &quot; The error is on line 6 though, instead of line 5 . . .
Start with looking at what was passed to your function. cfdump var="#arguments#" gets you started.
When I do a
in the main .cfm page before i call cfinvoke it has just what I expected, the form struct with all of its data. If I do
cfdump var=#data# (where data is the name of the argument)
nothing shows up, regardless of what I set the output parameter to.
I don't understand. Am I passing it incorrectly? Am I using it incorrectly once passed in? cfdump game me what I expected, but perhaps it should be showing up when I dump it in the .cfc?
Actually, nevermind, I still had the cfinvoke block commented out.
I uncommented it and the cfdump inside the cfc also displays exactly as I think it should, with the struct data.
So it looks like I'm sending and receive the information correctly, but I'm still getting the same error.
Ok, so something stupid, I forgot to put data.fieldnames in quotes . . .