我想找到將下面的html提交給cfc函數的最佳方法。in coldfusion 9,如何在文本中正確提交包含「,」的表單文本輸入數組?
<form action="test.cfc">
<input type="hidden" name="method" value="save">
<input type="text" name="mytext[]" value="f,oo">
<input type="text" name="mytext[]" value="bar">
<input type="submit">
</form>
test.cfc文件內容:
<cfcomponent displayname="test">
<cffunction name="init">
<cfreturn this>
</cffunction>
<cffunction name="save" output="false" returnformat="JSON" access="remote">
<cfargument name="mytext" type="string" required="true">
<!--- ***comments***
i want to do this:
<cfloop list="arguments.mytext" index="curRowValue">
<cfquery blah blah...>
insert into fooBar (stuff) values (curRowValue)
</cfquery
</cfloop>
--->
<cfreturn arguments>
</cffunction>
</cfcomponent>
的'test.save()函數將返回此JSON在我的設置{mytext:"f,oo,bar"}
這將插入3行,而不是2,如果我註釋掉插入碼。混淆用戶輸入的文本和ColdFusion的標準列表定界符的正確方法是什麼?
這個問題是造成這個問題: http://stackoverflow.com/questions/5266522/on-keypress-event-how-do-i-change-a-to-a – DefyGravity 2011-03-11 20:26:09