AJAX (jQuery) bug?
I am trying to make an AJAX post with jQuery, and for some reason one form field is not going through.
I have a simple form where the user can post a note and check a box. If I set the form to do a normal submit (i.e. load a new page), everything works fine. If I change it to an AJAX submit, where the page doesn't reload, I get an error that says "APPLICANTID is undefined in FORM."
<form action="inc/moderation-ajax.cfm" class="moderation" id="m#extendedFetch.id#" method="post">
<div>
Leave <label for="note">a note for this applicant</label>:
</div>
<textarea id="note" name="note" title="Special Note">Hello world!</textarea>
<div>
<input type="checkbox" id="approve" name="approve" title="Approve This Application" value="1" checked="checked" />
<label for="approve">Approve this application.</label>
</div>
<input type="hidden" id="applicantID" name="applicantID" value="#extendedFetch.id#" />
<button type="button" class="moderate-button" value="Submit" title="Submit">Submit</button>
</form>
When you click the button, it does a jQuery AJAX call, and the ColdFusion submit code looks like this:
<cfquery name="extendedFetch" datasource="#application.dsn#">
UPDATE My_Application
SET note = <cfqueryparam CFSQLtype="CF_SQL_LONGVARCHAR" value="#form.note#">,
moderation = <cfqueryparam CFSQLtype="CF_SQL_INT" value="#form.approve#">
WHERE ID = #form.applicantID#
</cfquery>
The AJAX errors out and says: "APPLICANTID is undefined in FORM.
What is going wrong here?
