I have a customer update form populated by the CFC page, the
code for the update button is as follows... (messy I know) - I have
tried doing this with a javascript -> coldfusion array but I was
getting a dereference scalar error.
<input type="button" value="Update Customer"
onclick="updateCustomer(<cfoutput>'#arguments.cst_id#'</cfoutput>,
fetchElement('new_title').value,
fetchElement('new_firstname').value,
fetchElement('new_lastname').value,
fetchElement('new_address').value, fetchElement('new_city').value,
fetchElement('new_postcode').value,
fetchElement('new_phone').value, fetchElement('new_phone2').value,
fetchElement('new_fax').value, fetchElement('new_email').value,
fetchElement('new_details').value,
fetchElement('new_creditlimit').value,
fetchElement('new_creditperiod').value,
fetchElement('new_creditstop').value,
fetchElement('new_discount').value)"/>
the updateCustomer function is as follows
function updateCustomer(cst_id, cst_title, cst_firstname,
cst_lastname, cst_address, cst_city, cst_postcode, cst_phone,
cst_phone2, cst_fax, cst_email, cst_details, cst_creditlimit,
cst_creditperiod, cst_creditstop, cst_discount) {
// send data to CF
DWREngine._execute(_ajaxConfig._cfscriptLocation, null,
'updateCustomer', cst_id, cst_title, cst_firstname, cst_lastname,
cst_address, cst_city, cst_postcode, cst_phone, cst_phone2,
cst_fax, cst_email, cst_details, cst_creditlimit, cst_creditperiod,
cst_creditstop, cst_discount, updateCustomerResults);
}
// call back function
function updateCustomerResults (r) {
// evaluate server side JS
eval(r);
}
If I put an alert(cst_id); etc... I can confirm the correct
fields are passed to the function.
But when this code runs through the ajaxCFC stuff it comes
out the other end all wrong! the cst_phone is updating the
cst_creditlimit etc.. I think it's the ajaxCFC software because I
get argument errors if I pass a string through the cst_phone it
tells me cst_creditlimit requires numeric. The arguments are in the
same order as the javascript function uses.
The beginning of my CFC function is as follows
<cffunction name="updateCustomer" output="no"
access="private">
<cfargument name="cst_id" type="string"
required="Yes">
<cfargument name="cst_title" type="string"
required="Yes">
<cfargument name="cst_firstname" type="string"
required="Yes">
<cfargument name="cst_lastname" type="string"
required="Yes">
<cfargument name="cst_address" type="string"
required="Yes">
<cfargument name="cst_city" type="string"
required="Yes">
<cfargument name="cst_postcode" type="string"
required="Yes">
<cfargument name="cst_phone" type="string"
required="Yes">
<cfargument name="cst_phone2" type="string"
required="Yes">
<cfargument name="cst_fax" type="string"
required="Yes">
<cfargument name="cst_email" type="string"
required="Yes">
<cfargument name="cst_details" type="string"
required="Yes">
<cfargument name="cst_creditlimit" type="numeric"
required="Yes">
<cfargument name="cst_creditperiod" type="numeric"
required="Yes">
<cfargument name="cst_creditstop" type="numeric"
required="Yes">
<cfargument name="cst_discount" type="numeric"
required="Yes">
Any ideas? thanks.