表单不工作,没有通过CFC发布到数据库,或者似乎正在使用脚本。当您单击PostComment按钮时,什么也不会发生。我花了一天的时间尝试了很多很多不同的东西。不同的按钮和不同的代码,有些会让事情变得更糟,大多数只是导致错误或刷新页面。我在下面的代码中没有得到任何错误,但是什么也没有发生。
有人能看到我在做什么吗?
表格
<CFFORM NAME="PostComment" ID="PostComment" METHOD="POST" onsubmit="return false;">
`<CFINPUT TYPE="hidden" NAME="CommentSection" VALUE="#CommentSec#">` `<CFtextarea name="Comment" rows="10" cols="50"></CFtextarea>` `<CFINPUT type="image" name="Submit" id="PostComment" value="Post Comment" src="images/PostComment.gif" width="70" height="15" onmouseover="src='images/PostCommentOVER.gif'" onmouseout="src='images/PostComment.gif'">`</CFFORM>
脚本
<cfajaxproxy cfc="CFC/PostComment" jsclassname="PostCommentCFC">
function PostComment() {
var cfc = new PostCommentCFC();
cfc.setCallbackHandler(getComment);
cfc.Comment(true); var targetPostCommentResponse = document.getElementById("targetPostCommentResponse").style.display='block';
var targetMakeComment = document.getElementById("targetMakeComment").style.display='none';
$('#OpenMakeCommentResponse').html("make a comment");
$('#CloseMakeCommentResponse').html("");
return false;
}
CFC PostComment
<cfcomponent>
<cffunction name="PostComment" access="remote">
<cfargument name="CommentSection" type="string" required="true" />
<cfargument name="Comment" type="string" required="true" />
<CFQUERY NAME="Comment" DATASOURCE="MyDSN">
INSERT INTO Comments(ID,Comment,CommentSection,CommentDate)
VALUE (#COOKIE.ID#,'#arguments.Comment#',#arguments.CommentSection#,#Now()#)
</CFQUERY>
<cfreturn true>
</cffunction>
</cfcomponent> 发布于 2010-11-20 01:24:04
我没有发现你的代码有任何错误,我广泛使用cfajaxproxy。它可能是很小的东西。
我会使用firebug和RIAForge http://riaforge.org上提供的名为coldfire的firebug扩展coldfusion进行调试,如果您使用的是ColdFusion构建器,则可以使用可用的冷融合调试器,并且在较小程度上是cfeclipse的一部分。
祝好运
https://stackoverflow.com/questions/3964556
复制相似问题