On 11/13/00, Tammy Schilling penned:
>I'm relatively new to CF.  I'm trying to design an interface for a local
>non-profit that holds monthly meetings to track attendance at those
>meetings.  I have an Access db with a table called Attendance.  This
>tables columns are the ID for each member and one for each month,
>Jan-Dec.  They keep a "rolling calendar", so year is not a factor in the
>attendance tracking.  They just want each month's attendance to write
>over the attendance in that month from the year before.
>
>The ID column is a number column and each of the month columns are
>yes/no.  I have an interface which pulls the names of members who've
>attended in the last 12 months (in order to minimize the number
>displayed and make it more useable) along with a check box to be checked
>if the person was at that month's meeting, but I can't seem to get the
>form to work.  I know it's probably something simple, but I've been
>banging my head against it for too many hours now and can't think
>anymore.  Some help would be appreciated, please.
>
><snip>
>
>This is the form
><FORM ACTION="process_janatten.cfm" METHOD="POST">
><INPUT TYPE="checkbox" NAME="January" VALUE="#January#">
><INPUT TYPE="text" NAME="FirstName" SIZE="30" MAXLENGTH="30"
>VALUE="#LastName#, #FirstName#">
>
>This is the form action query
><CFQUERY DATASOURCE="LLL">
>UPDATE Attendance
>SET January = '#January#'
>WHERE ID = #ID#
></cfquery>

Well, the first thing is, if you pass multiple checkboxes with the 
same name, you'll be passing a list. I don't see why you need the 
text input either, unless you're inserting new members. But, that's a 
whole other story.

I would do the form like this (I'm only setting January to save 
space, add all 12 months, then choose the month you're updating). 
You'll only need one form and one template to handle all 12 months. 
Of course, if you'd rather use 12 templates, just delete that part.

<FORM ACTION="process_janatten.cfm" METHOD="POST">
<select name="month"><option value="January">January
</select><br>
<CFOUTPUT query="Active_Moms">
<INPUT TYPE="checkbox" NAME="ID" VALUE="#ID#">
#LastName#, #FirstName#<br>
</CFOUTPUT>

<input type="Submit" value="Submit">
</form>

The choose the month and check everyone that was there.

Now, since you are passing a checkbox, anyone that wasn't in 
attendance (isn't checked) won't have their ID passed, so we need to 
set ALL the values for January to 0

<CFQUERY DATASOURCE="LLL">
UPDATE Attendance
SET #form.month# = 0
</cfquery>

Then set those in attendance to 1. Note again, if members 3, 7, 8, 
and 10 were in attendance, form.ID will be passed as 3,7,8,10

<CFQUERY DATASOURCE="LLL">
UPDATE Attendance
SET #form.month# = 1
WHERE <cfloop index="ThisID" list="#form.ID#">ID = #ThisID#
or </cfloop>0=1
</cfquery>

Again, if you'd rather use 12 templates, just change #form.month# to 
the month for each template.

Hope that helps.
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to