Hi,
I defined some JavaScript code to be executed when working with the āeditviewā of a module. This works fine without errors when I edit an already existing record. When creating a new record, I get an error in the JavaScript console, which says:
sugar_grp1_yui.js?v=7aThOBuXRfTTKf0x19Do4g:16 GET http://127.0.0.1/abc/src=%22custom/Extension/javascript/custom_js.js?v=7aThOBuXRfTTKf0x19Do4g%22 403 (Forbidden)
The problem seems to be the āsrc=ā substring in the GET command. This is obviously not a valid file path. It seems when creating a record the string for accessing the JavaScript is erroneously build. At least I am not surprised that is says 403 Forbidden as error - this file does not exist. It should be ā¦/abc/custom/ not ā¦/abc/src=%22custom
This only happens for creating new records not when editing existing ones, which confuses me a bit. I would expect that both are the same operation just that one is populated with field values from the DB while the other one is blankā¦
I am rather new to SuiteCRM and I would appreciate any ideas how to trace this error.
I donāt think itās possibly to help you unless you provide the exact paths and contents of your customizationsā¦ if you donāt know what you did, we canāt find out how you broke thingsā¦
And donāt forget to tell us your SuiteCRM version, please
I will try my best to provide you all needed details :). My JavaScript code looks like this - it just adds a line of text to the end of the panel. The file is called custom_js.js and is located in '<my_module>/Ext/javascript/custom_js.js
The content:
$(function(){
document.getElementById('detailpanel_-1').innerHTML+='<span> * marks mandatory information</span></p><br>';
});
I added the JavaScript extension by editing the editviewdefs.php and adding the āincludesā entry to the array pointing to above file
Can you try all Javascript repairs from Admin/Repairs? Including the one about āgroupingsā
Is your Javascript function getting loaded (included) with the page? I assume not, given the error message, but I just want to check.
EDIT: I think you shouldnāt be putting your custom file in that place, you shouldnāt mix this with the Extension framework. Just put somewhere like this:
I used all repair choices which related to JavaScript but this did not help. The error 403-forbidden remains and no, the script code is not added to my web page.
Is there a way to find the location in the backend where this string for accessing the javascript file is build?
Ah, sorry. No, I didnāt. Now it works. Thank you!
I positioned this file outside the module folder because I need it in various modules. Is there a folder where scripts for multiple modules should be stored?
Can you explain to me why the edit-operation did succeed while the create did fail to find/use/load the file? I still donāt fully understand the problem ?
I think you can put it wherever you want, since it uses a direct reference the system should pick it up (from ācustomā, or ācustom/modulesā, if you want).
I donāt know how to explain the previous behavior - the Extension framework aggregates pieces of customization into a new file that gets used by the system. So what happens there also depends on what other files you have in your system. But I canāt see how it could make a difference between one view and the other :huh:
Iāve just had the same issue in SuiteCRM 7.11 as well. It seems like when specifying path using \\ it does prepend src= to the request path for some reason (Only happens in creation page. Edit page works both ways). However specifying path with / seems to work fine.