0% found this document useful (0 votes)
13 views3 pages

Js con Peoplecode

Implementar Javascript con PS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Js con Peoplecode

Implementar Javascript con PS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Hiding Delivered Buttons based on condition

One-way to hide PeopleSoft delivered component events buttons (Save, ReturnToList, Add, UpdateDisplay…. etc.) by
using JavaScript. Follow the below steps to hide the delivered buttons.

This way can be used if we have many pages in component and we don’t want delivered buttons on some pages. Here are
steps.

Step1: Place HTML area in page and assign derived and work record (Say: HIDE_WRK) and field (Say: HTMLAREA)
to it.

Create HTML Definition (Say: HIDE_BT_HTML) and Add following JavaScript.


<script>
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}

function appsDisablePTControls() {
var aPTButtons = ['#ICSave', '#ICList', '#ICNextInList', '#ICPrevInList',
'#ICSendNotify', '#ICNext', '#ICSpellCheck', '#ICRefresh', '#ICAdd', '#ICUpdateAll',
'#ICCorrection', '#ICUpdate'];
appsDisableTable(aPTButtons, true);
}

function appsDisableTable(aPTControls, bButtons) {


var aControls, oTableNode;
var bFound = false;
var i = 0;
while (i < aPTControls.length && !bFound) {
aControls = document.getElementsByName(aPTControls[i]);
if (aControls != null && aControls.length > 0) {
oTableNode = aControls[aControls.length -
1].parentNode.parentNode.parentNode.parentNode;
if (oTableNode != null && oTableNode.id != 'RBTBHEADER' && oTableNode.id !=
'RBTBFOOTER') {
if (bButtons)
oTableNode = oTableNode.parentNode;
oTableNode.style.display = 'none';
bFound = true;
}
}
i++;
}
}
addLoadEvent(function() {
%bind(:1)
});
</script>

Then assign the following code to Page Activated event:


HIDE_WRK.HTMLAREA.Value = GetHTMLText(HTML.HIDE_BT_HTML, "appsDisablePTControls()");
Disable Peoplesoft radio button using javascript
In my recent development, I need to disable one of three radio buttons based on a condition. The dilemma here is that a
radio button is using the same field, so using field property displayonly = True or enabled = False won't work in this sense.

How do I do this:

To something like this (note: catch up below is grayed out):

Here is a step by step work around to disable one radio button using a simple javascript.

1. We need to set a page field name from the radio button properties. I named this one "ADJ_CATCHUP".

2. Place HTML area to the bottom of the page to make sure that the page had been fully rendered before the
javascript being called)

3. Assign Record and Field into the HTML area properties

4. Create a new HTML definition


Note: (I use bind variable so I can reuse this HTML code with a different field name or property(true/false)
5. Place the peoplecode below where you need it. In my case, I put it in the page activate.
If &_has_paid_amounts is True, then it will disable catch up radio button. Otherwise, enable it.

6. That should be it.

You might also like