views:

15

answers:

0

Form is not working, does not post to the database though the CFC or seem to be working with the script. When you click on the PostComment button nothing happens. I just spent a day and tried many, many different things. Different buttons and different code, some made things worse and most just cased errors or refreshed the page. I’m not getting any errors with the code below but nothing happens ether.

Can anyone see what I am doing worng?

form

<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>

script

<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>