Michael Downey
Michael Downey

Reputation: 687

Jquery commenting, using ColdFusion and Access

I am trying to figure out why this is not posting to my database. When I hit Post Comment. Everything disappears as if it posted the comments but instead it doesnt do anything. Any help would be well appreciated. Thanks! I am not sure what else is missing.

       <html>

<script src="http://code.jquery.com/jquery-2.0.3.js">    
</script>

    <script type="text/javascript" language="javascript">
$(document).ready(function(){
 $("#addcomment").click(function () 
        $("#postComment").show("slow");
    });
});
    </script>

        <cfform name="InsertComments" id="InsertComments">
<div id="container">
    <div id="mainContent">
      <div id="addcomment"> <a href='#'>add comment</a></div>
        <div id='postComment'>
            <textarea name='comment' id='comment'></textarea>
            <input type='text' id='Image_ID'''></input type>
            <input type='submit' value='Post Comment' />
        </div>
    </div>  
    </cfform>
        <cfif IsDefined("form.InsertComments")>
                <cfif IsDefined("form.InsertComments")>
                    <cfquery datasource="AccessTest">
                        INSERT INTO CommentsDB (Remarks, Image_ID, Date_Time )
                        VALUES
                        (<cfqueryparam value="#form.comment#" cfsqltype="CF_SQL_LONGVARCHAR">
                    </cfqueryparam>
                        , <cfqueryparam value="#form.Image_ID#" cfsqltype="cf_sql_integer">
                    </cfqueryparam>
                        , <cfqueryparam value="#now()#" cfsqltype="cf_sql_timestamp">
                    </cfqueryparam>
                        )
                    </cfquery>
                </cfif>
            </cfif>
</div>

</html>

Upvotes: 1

Views: 64

Answers (1)

Dan Bracuk
Dan Bracuk

Reputation: 20804

Your cfif tag is looking for a form field named InsertComments. Your form does not have a field named InsertComments. The only field it has is called comment.

In fact, you probably don't even have any form fields. Your cfform tag does not specify the method and the default is "get". That produces url variables, not form variables.

Set debugging to on so you can see what variables you do have.

Upvotes: 1

Related Questions