我想找到将下面的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