Custom JavaScript Guidelines
Incorporating custom JavaScript programs is supported, but application developers and implementation teams should use custom JavaScript programs judiciously, and they should be well aware of any implications introduced by the custom code.
With the architecture of the PeopleSoft Fluid User Interface, PeopleTools provides increased flexibility and opportunity to customize. However, with that flexibility comes increased responsibility for developers to test and manage any custom code. PeopleTools can only impose logical restrictions and processing constraints on the code it delivers and tests.
When considering adding custom JavaScript programs, consider the following items:
-
All JavaScript shares the same namespace. That includes PeopleTools-delivered JavaScript, PeopleSoft application-delivered JavaScript, and your custom JavaScript. Therefore, to avoid overwriting global variables, functions, and objects defined by PeopleTools or PeopleSoft applications, you must prefix your global variable, function, and object names. For example, rather than naming your function showModal(), which would overwrite the PeopleTools-delivered showModal() function, name your function my_showModal() instead.
-
Include JavaScript files in component PeopleCode, such as PostBuild, for better performance. Otherwise, the system needs to perform extra processing, such as inserting references into the header and checking to make sure all of the styles have been downloaded and applied, and before completing the page load\activate process.
-
Avoid using custom JavaScript events on a control.
-
If there are any JavaScript errors from application loading, the page will also encounter problems loading.
-
Do not use JavaScript to change the structure of the document.
-
Don’t use JavaScript to add/change the free form styles on the controls. Use PeopleCode to change/add free form style.
-
Only add JavaScript events on the controls that do not have any system generated script.