If anyone is interested here is how I got this to work FINALLY!!
<cfoutput>
<cfif isDefined("form.submit")>
<cfloop index="i" list="#Form.employeeID#">
<cfif isDefined('form.reason#i#') AND #form["reason#i#"]# NEQ "">
<cfquery datasource="alere">
INSERT INTO nonproductivetime (
employeeID,
reason,
time,
addedby)
VALUES (
#form["employeeID#i#"]#,
'#form["reason#i#"]#',
#form["time#i#"]#,
'#session.user.username#'
)
</cfquery>
<cfelse>
</cfif>
</cfloop>
</cfif>
</cfoutput>
On Fri, Jan 28, 2011 at 7:46 PM, Monique Boea <[email protected]> wrote:
> Hello all.
>
> I have been trying to figure this out all day. Any assistance would be
> appreciated.
>
> I have a dynamic form that is in grid format:
>
> <cfform name="enterNonProd" action="#cgi.SCRIPT_NAME#" method="post">
> <table class="content" border="1" style="border-collapse:collapse;"
> cellpadding="5" cellspacing="5">
> <tr><td colspan="3"><span class="title"> Use the form below to
> enter non-productive time for agents. NOTE: Please enter time as
> minutes</span></td></tr>
> <tr>
> <td valign="top">
> <table class="content" cellpadding="5" cellspacing="5">
> <tr><td colspan="3" height="10"></td></tr>
> <tr><td><strong>AGENT</strong></td><td><strong>REASON
> CODE</strong></td><td><strong>MINUTES</strong></td></tr>
> <cfloop query="users">
> <cfif users.roleID NEQ 1>
> <tr>
> <td><input name="user#employeeID#" type="checkbox"
> value="#users.employeeID#"> #users.firstname# #users.lastname#</td>
> <td>
> <CFSELECT NAME="code#employeeID#">
> <OPTION value=""></option>
> <OPTION value="Personal">Personal</option>
> <OPTION value="Gone Home">Gone Home</option>
> </CFSELECT>
> </td>
> <td><input name="minutes#employeeID#" value="" size="5"></td>
> </tr>
> </cfif>
> </cfloop>
> <tr><td colspan="3" height="20"></td></tr>
> <tr><td colspan="3" align="center"><input name="submit" type="submit"
> value="submit"></td></tr>
> </table>
> </td>
> </tr>
> </table>
> </cfform>
>
> When the form is submitted, I need to be able to insert the variables in
> the db:
>
> I have the following code that I am able to get the values of the form vars
> with but I don't know where to go from here:
>
> <cfoutput>
> <cfloop item="fname" collection="#form#">
>
> <cfset response = evaluate("form.#fname#")>
>
>
> <cfif response NEQ "" AND response NEQ "submit" AND #fname#
> NEQ "FIELDNAMES">
> #fname# - #form[fname]#
> </cfif>
>
>
> <cfquery datasource="alere">
> INSERT INTO nonproductivetime (
> employeeID,
> code,
> minutes)
> VALUES (
> <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#form[fname]#">,
>
> <cfqueryparam cfsqltype="CF_SQL_CHAR" value="#form[fname]#">,
> <cfqueryparam cfsqltype="CF_SQL_CHAR"
> value="#form[fname]#">
> )
> </cfquery>
>
> </cfloop>
>
> </cfoutput>
>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341683
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm