I've moved on to an open source cfml engine, don't know what caused the
following odd behavior, that is, my cfajaxproxy tag no longer works for an
inline data editing function (meaning, it does not do database update for a set
of data) while the same code works for ms sql server 2005 express (db syntax
are exactly same for such a simple query) and since I'm using "sync" mode I
can't use the setCallbackHandler method to do debugging. Thought, could use
more heads here...
caller line
<cfajaxproxy cfc="myCFC4inlineEdit" jsclassname="UpdateObj2" />
cfc code and js code below,
<cfcomponent output="false">
<cfset THIS.dsn="myDS">
<cffunction name="doUpdate" access="remote">
<cfloop item=i collection="#arguments#">
<cfif Left(i,6) IS "someID">
<cfset someid = "arguments.#i#">
</cfif>
<cfif Left(i,4) IS "uaid">
<cfset uaid = "arguments.#i#">
</cfif>
<cfif Left(i,5) IS "whats">
<cfset whats = "arguments.#i#">
</cfif>
</cfloop>
<cfif not isdefined("arguments.userID")>
<cfset arguments.someID = 'dummyID728932'>
</cfif>
<cfset fmtwhats = REreplace(Evaluate(whats),"'","''","ALL")>
<cfset fmwhats = REreplace(fmtwhats,'"',"''","ALL")>
<cfparam name="result" default="success">
<cftry>
<cfquery datasource="#THIS.dsn#">
update blablaTBL
set whats = '#fmwhats#'
where uaid = <cfqueryPARAM value = "#Evaluate(uaid)#"
cfsqltype="CF_SQL_INTEGER">
and sid = <cfqueryPARAM value =
"#Evaluate(someid)#"
cfsqltype="CF_SQL_VARCHAR"
maxlength="128">;
</cfquery>
<cfcatch type="database"><cfset result="failed">
</cfcatch>
</cftry>
<!---cfreturn #fmWhats#--->
<cfreturn #result#>
</cffunction>
</cfcomponent>
// much credit goes to Sam Farmer for getting me started on this (JSON) approach
function callUpdateJS2(frm,row) {
rowUpdate(frm,row);
}
function handleResult(r) {
console.log(r);
}
function rowUpdate(frm,row){
// var d = new DraftObj();
var d = new UpdateObj2();
d.setSyncMode(true);
d.setForm(frm);
d.setHTTPMethod('POST');
// d.doUpdate();
// expect d.doUpdate() to return "failed" or "success" string
// BUT it doesn't!
// update {notes} field; 05/28/2008
document.getElementById(row).innerHTML = d.doUpdate();
}
Forgive me about the formatting and typo if any.
Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325549
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4