Javascript Function is not a function... (Not the error of "function is not defined")

I encounter the following issue after upgrading from sugar CRM to suiteCRM v7.10.x

I have the following javascript function put in a javascript file named receipt.js:

function getReceipt() {
    open_popup('ReceiptPage', '580', '380', '&pcr=pcr&record=' + $('[name="record"]').val() + '&module_name=ReceiptPage', true, false, { 'call_back_function': 'set_return', 'form_name': 'EditView', 'field_to_name_array': [] });
}

Inside receipt.js, I already implemented a few functions and they’re all working fine except getReceipt() function. I always get the error “getReceipt is not a function at HTMLInputElement.onclick”.
I believe there is something wrong with the function, because the message is not “is not defined” but it is “not a function”, and the rest of the functions are working fine within the same file “receipt.js”.

Is there anything wrong with my function? Your expertise comments are appreciated.

Hey there,

Have you been able to resolve your issue?


I’m not much of an expert in JavaScript, but I believe you can get similar errors when a Function has the same name as an Element ID/Name on the page

(See example: javascript - JS: Uncaught TypeError: object is not a function (onclick) - Stack Overflow)

Perhaps re-naming this function may resolve the issue?

A lot has changed from SugarCRM to SuiteCRM, so there very well may now be an element on the page with the same name now.


Otherwise, I’m not too sure, I’m afraid :slightly_frowning_face:

Perhaps giving context/screenshots/code snippets of where this Function is called from, may help anyone more knowledgable in JS, if they come across this thread?