A cleaner way to do it would be to use the SetVariable function imo.
<cfset rs = setVariable("client.#form_element#", "...")>
--
jon
mailto:[EMAIL PROTECTED]
Wednesday, August 14, 2002, 12:02:05 PM, you wrote:
SY> <cfset "client.#form_element#" = ...
SY> Try that...
SY> -----Original Message-----
SY> From: Bill Poff [mailto:[EMAIL PROTECTED]]
SY> Sent: Wednesday, August 14, 2002 11:34 AM
SY> To: CF-Talk
SY> Subject: EmbedFields Hack
SY> Hello all,
SY> I'm trying to hack Ben Forta's EmbedFields tag to create client variables
SY> from passed form fields.
SY> CF does not like the 6th line. It doesn't like "<cfset client.#form_element#
SY> =...". It's generating an "Invalid Expression Format" error.
SY> Can someone offer me a suggestion on a better way to do this... one that
SY> works ;-)
SY> <CFIF #IsDefined("FORM.fieldnames")#><!--- Check that fieldnames exists --->
SY> <CFSET #fieldnames_processed# = ""><!--- Create empty list of processed
variables --->>
SY> <CFLOOP INDEX="form_element" LIST="#FORM.fieldnames#"><!--- Loop through
fieldnames --->>
SY> <CFIF #ListFind(#fieldnames_processed#, #form_element#)# IS 0><!--- Try to
SY> find current element in list --->
SY> <CFSET #form_element_qualified# = "FORM." & #form_element#><!--- Make
SY> fully qualified copy of it (to prevent acessing the wrong field type) --->
SY> <CFOUTPUT><cfset client.#form_element# =
SY> "#Evaluate(form_element_qualified)#"></CFOUTPUT><!--- Set Client
variable --->>
SY> <CFSET #fieldnames_processed# = #ListAppend(#fieldnames_processed#,
#form_element#)#>><!--- And add it to the processed list --->
SY> </CFIF>
SY> </CFLOOP>
SY> </CFIF>
______________________________________________________________________
This list and all House of Fusion resources hosted by CFHosting.com. The place for
dependable ColdFusion Hosting.
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists