Working with JavaScript

This topic discusses information related to using JavaScript with fluid applications.

PeopleTools includes an HTML definition, PT_PAGESCRIPT_FMODE, which serves as the master list referencing other definitions containing the actual JavaScript function definitions. These JavaScript functions control a wide range of page behavior, including (but not limited to):

  • Scrolling for group boxes.

  • Accordion widget.

  • Toggle widget.

  • Grouplet.

  • Drag and drop group boxes.

  • Grid lazy scroll.

  • Carousel – (used only for scroll areas).

  • Transfer animations.

  • File attachments.

  • Search page and NavBar.

  • Related action menu.

  • Side page tabs.

  • New action buttons – Back, Home, Logout

  • Search side page.

Use the AddOnLoadScript PeopleCode built-in function to invoke delivered JavaScript functions. The following example illustrates two invocations of AddOnLoadScript:

If (IsGroupletRequest()) Then;
   AddOnLoadScript("DoRowAction(" | &nRow | ");");
End-If;

AddOnLoadScript("SetSideTopTitle('" | EscapeHTML("My M/D Component's Title") | "');");

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:

  • 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 onload, 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.