This content has been marked as final. Show 6 replies
At this point you haven't actually got any array values set. What you're doing is creating a form field with the name parameter set to #reasonArray[report_id]#". This array has not been populated with anything, so it's failing.
What are you trying to achieve?
I'm trying to set the array index equal to the value entered in the textbox. Later I need to send an e-mail that goes through each report id, sees if it's been selected, and if it has, lists the reason for that report.
Please let me know if this still isn't clear.
In my experience, you must directly populate an array element with an assignment. You might try the following: name="R#report_id#" In your action page, you can easiely assign the Rnnn to the reasonArray, using nnn as the index into the array.
BTW, you have a logic error in the first part of your code. If the <CFIF> statement is FALSE, you do not get the <TR tag, and style="font-size:11;"> is hanging out.
OK, so the array serves no purpose on the form page, since you don't yet have any data. You need that on the action page.
Hopefully this will give you some pointers...
<input type="text" name="data_#getReports.report_ID#">
<inputy type="hidden" name="report_ids" value="#report_id#">
<Cfloop list="#report_ids#" index="report_id">
<cfoutput><br>#report_id# = #thisReportData#</cfoutput>
Thank you so much! That was actually my backup solution that I've been using, but it doesn't work without the form so I've been writing everything out, which defeats the whole purpose of dynamic code. Do you know where I can find documentation on that part?
Also, jdeline, thanks for your comment about the logic error. I edited a lot of the unnecessary code to make the post more readable and turns out it was just more confusing. Thanks though!
Honestly I'm not sure about the documentation part.
Basically, there's no difference between: -
form.my_field and form["my_field"]
They both reference the same value. But the array style notation is much more versatile and totally dynamic (plus avoids using evaluate - which is what we had to do many years ago!)
You can do the same thing with all the variable scopes
Use cfdump to see more, for example