Hello all!
I'm creating an Event management application in which an administrator
can insert in a table a row per Seminar including Date, Location,
SeminarName based on checkboxes from the seminar table. My problem is
that when my query is adding each row, it quits with the following error
when it hits the first checkbox that remained blank:
~~~~~~~~~~~~
An error occurred while evaluating the expression:
#Evaluate(SeminarID)#
Error near line 24, column 21.
------------------------------------------------------------------------
--------
An error has occurred while processing the expression:
form.SeminarID2
Error near line 1, column 1.
------------------------------------------------------------------------
-------
Error resolving parameter FORM.SEMINARID2
~~~~~~~~~~~~
I realize that I need to assign a value to any checkbox that remains
blank but I think my brain has turned to mush because I just can't
figure out where I am supposed to put the code and what the code's
supposed to say since I'm not very good at cfloops. Any help would be
greatly appreciated!
Here's the code I have thus far:
~~~~~~~~~~~~
Page #1 (which is getting some fields off a different form):
<cfset ScheduleDate=#form.ScheduleDate#>
<cfset LocationID = #form.LocationID#>
<cfquery name="seminar" datasource="seminar" dbtype="odbc">
SELECT *
FROM tblSeminar
ORDER BY SeminarName
</cfquery>
<form action="finish.cfm" method="post">
<cfoutput><input type="Hidden" name="RecordCount"
value="#seminar.RecordCount#"></cfoutput>
<input type="hidden" name="LocationID"
value="<cfoutput>#LocationID#</cfoutput>">
<input type="hidden" name="ScheduleDate"
value="<cfoutput>#ScheduleDate#</cfoutput>">
<cfoutput query="seminar">
<input type="checkbox" name="SeminarID#CurrentRow#"
value="#SeminarID#">
#SeminarName#"<br>
</cfoutput>
<input type="Submit" value="Save All">
</form>
~~~~~~~~~~~~
Page #2 (which inserts the data into the database):
<cfset Date = #form.ScheduleDate#>
<cfset LocationID = #form.LocationID#>
<cfloop index="i" from="1" to="#form.RecordCount#">
<cfset SeminarID = "form.SeminarID" & i>
<cfoutput>#SeminarID#</cfoutput>
<cfquery name="qryAddList#i#" datasource="seminar">
INSERT INTO tblSeminarSchedule
(Date, SeminarID, LocationID)
VALUES
('#Date#','#Evaluate(SeminarID)#', '#LocationID#')
</cfquery>
</cfloop>
-Marla Jenkins
Hurd IT Communications
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists