嘿伙计们,我在处理动态变量名称时遇到了一点问题。发生的事情是我有一个 CFC,它使用表格中的一些数据为我构建了部分表单。然后 cfc 将表单的代码作为字符串发送回页面。那么我需要为这些表单字段分配值,这样人们就不会覆盖数据。我在 cfc 的函数中提取数据。所以我试图把这个动态变量扔到字符串中,这让我搞砸了。我不断收到错误消息
A CFML variable name cannot end with a "." character.
这是我正在使用的代码,它给了我错误。我对编程的经验并不多,我做这件事的时间也不长。所以任何输入都会很棒。
<!--- ================================================================== --->
<cfargument name="catFormQuery" type="query" required="yes">
<cfargument name="listingID" required="yes">
<cfset var getListingInformation = "">
<cfset var returnVar = "">
<cfset var fieldValue = "">
<cfset var catNameNoSpace = "">
<!--- get the listing Information --->
<cfquery name="getListingInformation" datasource="backEndDSN">
Select * from listings
where listingID = #arguments.listingID#
</cfquery>
<cfoutput query="arguments.catFormQuery">
<!---====================--->
<!--- Set catNameNoSpace --->
<!---====================--->
<cfset catNameNoSpace = replaceNoCase(arguments.catFormQuery.catName, " ", "_")>
<!---==========--->
<!--- for text --->
<!---==========--->
<cfif arguments.catFormQuery.catType eq 'text'>
<cfset returnVar = returnVar & #arguments.catFormQuery.catName# & ": <input type='text' name='#catNameNoSpace#' value=" & getListingInformation.#catNameNoSpace# & "><br />">
</cfif>
所以无论如何,如果你能给我任何意见或建议,那就太好了。非常感谢。
代码就在底部。
<cfset returnVar = returnVar & #arguments.catFormQuery.catName# & ": <input type='text' name='#catNameNoSpace#' value=" & getListingInformation.#catNameNoSpace# & "><br />">