Then use your database engine GUI to add six months or so. It's not a big deal. You only need to fill in the date. (You'll probably code a short page to do this after you've used this idea for a while.)
It's tempting to delay the evaluate step until you're inside the query, but if you do this, the evaluate function will produce a raw string that ColdFusion will assign the string to the database "as is". We rely on ColdFusion to automatically escape single quotes when assigning variables to a database. So, do yourself a favor and create the variable first as shown here; so, ColdFusion can do the right thing during the query. (If you don't, the meeting schedule will break sometime around Secretaries' Day.) It's mechanical and therefore easy; just do it.
<cfparam name="form.Exit" default=""> <cfif len(trim(form.Exit))> <cflocation url="menu.cfm"> <cfabort> </cfif> <cfparam name="form.Save" default=""> <cfif len(trim(form.Save))> <cfset chg=structNew()> <cfloop list="#form.IDList#" index="ID"> <cfscript> chg.TMOD="form.TMOD_#ID#"; chg.TMOD=evaluate(chg.TMOD); chg.Event="form.Event_#ID#"; chg.Event=evaluate(chg.Event); chg.TopicsMaster="form.TopicsMaster_#ID#"; chg.TopicsMaster=evaluate(chg.TopicsMaster); chg.Speaker1="form.Speaker1_#ID#"; chg.Speaker1=evaluate(chg.Speaker1); chg.Length1="form.Length1_#ID#"; chg.Length1=evaluate(chg.Length1); chg.Manual1="form.Manual1_#ID#"; chg.Manual1=evaluate(chg.Manual1); chg.Nr1="form.Nr1_#ID#"; chg.Nr1=evaluate(chg.Nr1); chg.Subject1="form.Subject1_#ID#"; chg.Subject1=evaluate(chg.Subject1); chg.Speaker2="form.Speaker2_#ID#"; chg.Speaker2=evaluate(chg.Speaker2); chg.Length2="form.Length2_#ID#"; chg.Length2=evaluate(chg.Length2); chg.Manual2="form.Manual2_#ID#"; chg.Manual2=evaluate(chg.Manual2); chg.Nr2="form.Nr2_#ID#"; chg.Nr2=evaluate(chg.Nr2); chg.Subject2="form.Subject2_#ID#"; chg.Subject2=evaluate(chg.Subject2); chg.Away="form.Away_#ID#"; chg.Away=evaluate(chg.Away); chg.Notes="form.Notes_#ID#"; chg.Notes=evaluate(chg.Notes); </cfscript>
When you have defined every column of the row to be updated, run the update query. Because the structure contains values, the update is easy. For example, set Speaker1 in the table to '#chg.Speaker1#'. When you have done this for all columns, clear the structure so it can be used again, end the loop, and end the cfif statement. The where statement deserves special mention. It's good practice to assign the value of numeric variables to the database so that specially hacked ID strings don't do more than you bargained for.
<cfquery name="updMeeting" datasource="ic"> update Meeting set TMOD = '#chg.TMOD#', Event = '#chg.Event#', TopicsMaster = '#chg.TopicsMaster#', Speaker1 = '#chg.Speaker1#', Length1 = '#chg.Length1#', Manual1 = '#chg.Manual1#', Nr1 = '#chg.Nr1#', Subject1 = '#chg.Subject1#', Speaker2 = '#chg.Speaker2#', Length2 = '#chg.Length2#', Manual2 = '#chg.Manual2#', Subject2 = '#chg.Subject2#', Nr2 = '#chg.Nr2#', Away = '#chg.Away#', Notes = '#chg.Notes#' where MeetingID = #val(ID)# </cfquery> <cfset dummy=structClear(chg)> </cfloop> </cfif>
<cfquery name="dayList" datasource="ic"> select * from Meeting order by MeetingDt </cfquery> <form name="Meetings" action="meeting.cfm" method="post"> <table border="1" cellpadding="0" width="65%"> <cfset IDList=""> <cfoutput query="dayList">
Append the current MeetingID to IDList. Set a data cell to span the table. If this is the first week in the month (date less than 8), display the date followed by submit buttons: one to save the entire form and one to exit the form. If it is not the first week in the month, display just the date. Precede the the date with slashes slanting up and follow it with slashes slanting down to suggest a peak or a folder tab to get across the idea that associated data is below rather than above the date.
<cfset IDList=listAppend(IDList,MeetingID)>
<tr><td colspan="6">
// #dateFormat(MeetingDt,"d mmm yy")# \\
<cfif datePart("d", MeetingDt) lt 8>
<input type="submit" name="save"
value="Save entire schedule: refresh">
<input type="submit" name="exit"
value="Ignore unsaved changes: exit">
</cfif>
</td></tr>
Put TMOD, Event, and TopicsMaster fields in the same cell, spanning the table. Set the size of the fields to something appropriate based on anticipated font size, the length of the typical entries you expect, the appearance of the page, and the maximum length. Set the maximum length to match the column length (or less if you're still experimenting; you can fix the database later).
<tr><td colspan="6"> TMOD: <input type="text" name="TMOD_#MeetingID#" value="#TMOD#" size="13" maxlength="15"> Events: <input type="text" name="Event_#MeetingID#" value="#Event#" size="30" maxlength="30"> Topics Master: <input type="text" name="TopicsMaster_#MeetingID#" value="#TopicsMaster#" size="13" maxlength="15"> </td></tr>
Set a header and provide the speech information in tabular form. In the header, use two pound signs, not one, as the abbreviation for number. ColdFusion will convert this to a single pound sign for display. Again, set sizes for appearance (within the column length), and set maxlength to the length of the column.
<tr><td>..</td><td>SPEAKER</td><td>TIME</td> <td>MANUAL</td><td>##</td><td>SUBJECT</td></tr> <tr><td>1st:</td> <td><input type="text" name="Speaker1_#MeetingID#" value="#Speaker1#" size="13" maxlength="15"></td> <td><input type="text" name="Length1_#MeetingID#" value="#Length1#" size="4" maxlength="5"></td> <td><input type="text" name="Manual1_#MeetingID#" value="#Manual1#" size="26" maxlength="30"></td> <td><input type="text" name="Nr1_#MeetingID#" value="#Nr1#" size="1" maxlength="1"></td> <td><input type="text" name="Subject1_#MeetingID#" value="#Subject1#" size="37" maxlength="35"></td></tr> <tr><td>2nd:</td> <td><input type="text" name="Speaker2_#MeetingID#" value="#Speaker2#" size="13" maxlength="15"></td> <td><input type="text" name="Length2_#MeetingID#" value="#Length2#" size="4" maxlength="5"></td> <td><input type="text" name="Manual2_#MeetingID#" value="#Manual2#" size="26" maxlength="30"></td> <td><input type="text" name="Nr2_#MeetingID#" value="#Nr2#" size="1" maxlength="1"></td><td><input type="text" name="Subject2_#MeetingID#" value="#Subject2#" size="37" maxlength="35"></td></tr>
The Away field and Note textarea each get their own row, with the data spanning most of the table. "Note" in its singlar form tells the user to do something. Hence, it is used in the singular form as a label. However, the underlying column name is plural to avoid database engine conflicts. (The label and column should usually have the same basic name; this is a rare exception to this principle.) Set the size and maxlength as appropriate.
<tr><td>Away:</td> <td colspan="5"><input type="text" name="Away_#MeetingID#" value="#Away#" size="98" maxlength="110"></td></tr> <tr><td>Note:</td> <td colspan="5"><textarea name="Notes_#MeetingID#" cols="75" rows="2" wrap="virtual">#Notes#</textarea> </td></tr>
Wind down. Close the output. Close the table. Set a hidden field equal to the IDList that you've building while looping through the query for display. (Remember to surround the variable with cfoutput tags now that you're no longer within a pair of cfoutput tags.) Close the form.
</cfoutput> </table> <input type="hidden" name="IDList" value=<cfoutput>"#IDList#"</cfoutput>> </form>