Category Archives: JavaScript

Center align data in a PeopleSoft grid using JavaScript

I had a requirement to center align data in a PeopleSoft grid. Instead of messing with the delivered Style Sheets and creating new ones I simply adding an HTML area to my page and used JavaScript to center it.

getElementsByClassName() returns a HTMLCollection so you need to iterate through the results.

Here is the JavaScript example:


var elements = document.getElementsByClassName("PSLEVEL1GRIDODDROW");
for(var i=0, l=elements.length; i<l; i++)
{
elements[i].style.textAlign = "center";
}

Copying text on a PeopleSoft page to the Clipboard using JavaScript

I found a scenario where it would be nice to automatically copy text from a PeopleSoft page and place it into the Clipboard.

Here is how you can do it…
1. Add an HTML element to a page and change it to “Constant”
2. Then just past in this JavaScript. You will need to change the Id for your field you are wanting to copy.

This only works in IE but you could write it for cross-browser support.

I added this to copy the XML Schema from the message definition schema page.

Add JavaScript to a PeopleSoft Page

Add JavaScript to an HTML Area on a PeopleSoft Page to manipulate objects.
This hides a button till another object on the page appears…


I also added a group box around another object so it would give a unique id to a dynamic object. (win0divHRS_CE_LNK_WRK_PAGE_9)