All,
I'm still struggling with this particular piece of funtionality, so I'm
reposting...
I'm working on a class approval app where employees fill out a form to
request management approval to enroll in a company sponsored class.
An admin can go in and view all requests for each particular class, and
change each request status (registered, wait list, pending approval, not
approved, cancelled) via a dropdown list for each record. She can make all
of her changes on the one screen, and click submit to update all of the
records at once (via a loop in the update query in the action page).
Now, I don't want the admin to make the mistake of overbooking the class.
So, I pass a hidden field with each record to indicate what the original
status was for each record. Then in the action page, I'm trying to compare
the original status with the status the user (may have) changed it to. If
the admin changed a status to "registered" (represented by the value "1"),
then I want the registered_count to increment. I then want to compare the
registered_count to the maximum class size. If it has been exceeded, I want
to display a CFABORT error message before any data is even written to the
database.
This is what I've tried so far, but unfortunately, this is still allowing me
to register beyond the class capacity:
<cfloop list="#form.fieldnames#" index="ThisRow">
<cfloop from="1" to="#numrecords#" index="current">
<cfset new_status=#Evaluate("status_name" & current)#>
<cfset original_status=#Evaluate("original_status" & current)#>
<cfif (original_status NEQ 1 OR original_status IS "") AND new_status EQ 1>
<cfset registered_count=#incrementValue(registered.registered_count)#>
<cfset new_registered_count=#incrementValue(registered_count)#>
<cfelse>
<cfset new_registered_count=0>
</cfif>
</cfloop>
</cfloop>
Any suggestions?
Thanks!
Terri
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Share information about yourself, create your own public profile at
http://profiles.msn.com.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.