执行ajax组件http://path/to/my/component.cfc?method=something没有执行该方法
我有一个具有远程功能的 CFC,并尝试将其填充到我的 cfm 页面的 cfselect 元素中。 但我在选择中没有得到任何东西。
我尝试直接执行cfc,但是我调用的方法没有执行。
这是 CFC 的代码:
<cfcomponent output="false">
<cffunction name="getYear" access="remote" returnType="query">
<cfset yearlist = QueryNew("yr","integer")>
<cfset temp = QueryAddRow(yearlist,3)>
<cfset counter = 1>
<cfloop from="#evaluate(year(Now())-1)#" to="#evaluate(year(Now())+1)#" index="y">
<cfset temp = QuerySetCell(yearlist,"yr",y,counter)>
<cfset counter = counter + 1>
</cfloop>
<cfreturn yearlist>
</cffunction>
</cfcomponent>
这是 CFM 的代码
<body>
<cfform>
<table>
<tr>
<td>Select Year:</td>
<td><cfselect name="yearval"
bind="cfc:cfc.ajaxcomp.getYear()"
value="yr"
display="yr"
bindonload="true" /></td>
</tr>
</table>
</cfform>
</body>
您能告诉我这里缺少什么吗?
谢谢!
I have a CFC with a remote function and am trying to populate it into my cfm page's cfselect element. But I am not getting anything in the select.
I tried executing the cfc directly, but the method that I call does not execute.
Here is the code for the CFC:
<cfcomponent output="false">
<cffunction name="getYear" access="remote" returnType="query">
<cfset yearlist = QueryNew("yr","integer")>
<cfset temp = QueryAddRow(yearlist,3)>
<cfset counter = 1>
<cfloop from="#evaluate(year(Now())-1)#" to="#evaluate(year(Now())+1)#" index="y">
<cfset temp = QuerySetCell(yearlist,"yr",y,counter)>
<cfset counter = counter + 1>
</cfloop>
<cfreturn yearlist>
</cffunction>
</cfcomponent>
Here is the code for the CFM
<body>
<cfform>
<table>
<tr>
<td>Select Year:</td>
<td><cfselect name="yearval"
bind="cfc:cfc.ajaxcomp.getYear()"
value="yr"
display="yr"
bindonload="true" /></td>
</tr>
</table>
</cfform>
</body>
Could you please tell me what am I missing here?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以下面的代码对我有用。 我改变了一些东西,很难知道它做了什么,但是:
-
So the following code works for me. I changed a few things, so hard to know what did it but:
-