2013-09-11 19 views
1

我使用的是简单绑定声明:在CFInput绑定不能援引CFC

<cfform name="myform" method="post" > 
    First Name: <cfinput type="text" name="firstname" required="yes"><br> 
    <cfinput type="text" size="60" name="email1" 
     bind="cfc:/cfdocs/ZH/Controllers/CalendarServices.getEmailId()"> 
</cfform> 

功能getEmailId看起来像:

<cffunction name="getEmailId" access="remote"> 
    <cfargument name="firstname" type="string" required="true"> 
    <cfreturn "#arguments.firstname#@zhtest.com"> 
</cffunction> 

绑定作品 “本地”,即不使用氟氯化碳。如果我从CFM页面调用CFC,CFC将起作用,但不会从绑定中调用它。

我知道CF正在查看正确的文件。如果我更改路径或函数名称,或将访问权限改为除“远程”之外的任何内容,则会给我一个错误。但是,即使我已经提出了firstname参数,CF也不会给我一个错误。我究竟做错了什么?是否有防止CFC返回值的安全设置?

+1

你的函数有一个强制性的参数,我没有看到你传递一个表单中的码。 –

+1

请停止使用'cfform','cfinput'和ColdFusion的其他UI/JS功能。学习如何用正确的方式使用jQuery等JS库。它会为你节省很多头痛的道路。 –

+2

[Ben Forta博客 - 使用ColdFusion客户端技术不再有用时](http://forta.com/blog/index.cfm/2012/11/25/When-Using-ColdFusion-No-Longer-Makes-Sense ) –

回答

0

如果你决定使用绑定,改变你的cfinput标签来传递变量,并添加bindonload属性:

<cfinput type="text" size="60" name="email1" bind="cfc:/cfdocs/ZH/Controllers/.getEmailId({firstname})" bindonload="true">