----- Original Message -----
From: "Philip Arnold" <[EMAIL PROTECTED]>
Date: Sun, 4 Jan 2004 10:55:49 -0500
To: CF-Talk <[EMAIL PROTECTED]>
Subject: RE: Dynamic Array or Structure
Just one point, please don't use Evaluate() - it's incredibly slow...
Also, if you are, then use your quotes and pounds sparingly:
#evaluate("#formfield#")# is the same as #evaluate(formfield)#
But if you can, use scoping and square bracket notation
Square bracket notation works like this:
#evaluate("form.#fieldName#")# should be #form[fieldName]#
Anyways, since you're running through a loop, you should be able to pass
through lists of the fields - your "auditList" can be passed happily
Although I'm not sure what your "formField" is for
> -----Original Message-----
> From: Spectrum WebDesign [mailto:[EMAIL PROTECTED]
> Sent: Sunday, January 04, 2004 8:31 AM
> To: CF-Talk
> Subject: Dynamic Array or Structure
>
>
> I'm looking for tips, how to's, tutorials, code for auditing
> tool for my solution:
>
> Please see this:
>
> Original values for form fields have Original string append
> this names...
> intQtyContentOriginal,strNameFirmsOriginal,EmailUserOriginal
>
>
> <!---audit--->
> <!---form fields - can be change for users --->
> <cfset auditList = "intQtyContent,strNameFirms,EmailUser">
>
> <cfloop index="fieldName" list="#auditList#">
> <!---set up Original form field--->
>
> <CFSET formfield=fieldName & "Original">
>
> <cfif Len(Trim(evaluate("form.#fieldName#"))) NEQ 0 AND
> (evaluate("form.#fieldName#") NEQ evaluate("#formfield#"))>
> <cfquery name = "WriteAudit"
> datasource = "#dsn#">
> insert into tblAudit
> (strSiteID
> ,strUserID
> ,intAreaSite
> ,strTableName
> ,strFieldName
> ,strValueOld
> ,strValueNew
> ,dtDateChange)
> values
> (<cfqueryparam value="#Session.Auth.strSiteID#"
> CFSQLType="CF_SQL_VARCHAR" maxlength="35">
> ,<cfqueryparam value="#Session.Auth.UserID#"
> CFSQLType="CF_SQL_VARCHAR" maxlength="35">
> ,1
> ,'tblSite'
> ,<cfqueryparam value="#fieldName#"
> CFSQLType="CF_SQL_VARCHAR" maxlength="100">
> ,<cfqueryparam value='#evaluate("#formfield#")#'
> CFSQLType="CF_SQL_VARCHAR" maxlength="255">
> ,<cfqueryparam value='#evaluate("form.#fieldName#")#'
> CFSQLType="CF_SQL_VARCHAR" maxlength="255">
> ,<cfqueryparam value="#Now()#"
> cfsqltype="cf_sql_timestamp">)
> </cfquery>
> </cfif>
> </cfloop>
> <!---end audit--->
>
> Works fine for only 1 form. But i'm looking for a solution
> (Custom Tag, cfscript) for any form passing parameters like
> form fields(names and content) and original form fields(names
> and content. too). Array maybe works. Or structure?
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

