tag:blogger.com,1999:blog-34020393.post5798618804251773387..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: JavaScript Meta blogJim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger52125tag:blogger.com,1999:blog-34020393.post-80189855704420144562016-04-08T16:43:49.152-07:002016-04-08T16:43:49.152-07:00@Paul, great information. No reason not to use it....@Paul, great information. No reason not to use it.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-7255173239718057852016-04-08T09:58:03.903-07:002016-04-08T09:58:03.903-07:00Hi Jim,
I'd like to run a solution I've c...Hi Jim, <br />I'd like to run a solution I've come up with regarding the 'getting the page name in javascript' question by you. If you post to the current url with (at least) two passed parameters - ICAJAX=1&ICAction=%23KEYCJ - you'll receive a response with the information from the CONTROL+J information page. One of the first elements is the PAGE tag, which has the pagename as the id. It's pretty simple to grab that value and use it for whatever script is executing. Is there any reason not to go about getting the page name this way? So far it's the only way I've found to reliably get the page name regardless of location in the application. <br />thanks, <br />Paul Unknownhttps://www.blogger.com/profile/11724300872535035532noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-59468570010625628152015-09-02T14:51:37.056-07:002015-09-02T14:51:37.056-07:00@Nandini, I don't know of ways to improve perf...@Nandini, I don't know of ways to improve performance. As the comment stated, I just know of a way to lazy load the rows or paginate the rows. This involves adding an HTML Area to the page along with a Derived/Work record field and an HTML definition. There are many lazy load table alternatives and I have no recommendations on which to use.<br /><br />The iscript data source for the paginated or lazy loaded table will require parameters to identify which set of rows to display.<br /><br />Part II of my PeopleTools Tips and Techniques book provides a lot of guidance on using jQuery with PeopleSoft. It does NOT show a lazy loaded table, but should give you the foundation you need to implement one.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-12758784330283082372015-09-02T12:46:22.147-07:002015-09-02T12:46:22.147-07:00Hi,
I came across one of your comments on an issue...Hi,<br />I came across one of your comments on an issue (http://peoplesoft.ittoolbox.com/groups/technical-functional/peopletools-l/performance-on-load-peoplesoft-grid-2675447) and am looking for more guidance on the same. We have a PS page with a grid on it that times out whenever there are a lot of rows that need to be loaded. What are some of the ways I can use to improve performance on it? I've not worked with jQuery but am open to learning about it and trying it as a solution. Any help will be appreciated. Thanks!Nandini Gopinathhttps://www.blogger.com/profile/13577723221780458524noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-55518340056191899512015-08-04T11:22:24.469-07:002015-08-04T11:22:24.469-07:00@Muthu, when you say, "iframe," if you a...@Muthu, when you say, "iframe," if you are referring to the standard PeopleTools iframe and the content is the component page, then a JavaScript HTML definition common to all components is PT_COMMON. This is where I place JavaScript in pre-8.54 environments. In 8.54 and higher, I use the branding system options page to insert JavaScript globally into all components. Earlier versions of PeopleTools 8.5 and lower (not sure if it was 8.52 or 8.51) used PT_COPYURL, which was a VERY small HTML definition. That was my favorite because it was small so it was easy to locate customizations.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-72940475981584726122015-08-04T10:47:14.403-07:002015-08-04T10:47:14.403-07:00Hi Jim,
I have a requirement in such a way that I...Hi Jim,<br /><br />I have a requirement in such a way that I need to execute a JavaScript in ALL transaction pages commonly to find out a field (for e.g., salary) using DOM. The target pages are loaded inside an iframe. The fields that I am trying find are lying inside these iframes. Which html (or anywhere else) will be suitable to add this JavaScript?Anonymoushttps://www.blogger.com/profile/06897829850466353989noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-3147759784970940832015-02-20T19:59:58.827-08:002015-02-20T19:59:58.827-08:00@AK, hopefully that was enough information to give...@AK, hopefully that was enough information to give you direction.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-67418804979946071792015-02-20T19:18:09.764-08:002015-02-20T19:18:09.764-08:00Thanks so much for your response Jim.
Regards,
A...Thanks so much for your response Jim. <br /><br />Regards,<br />AKAnonymoushttps://www.blogger.com/profile/17572839615273095869noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-10959406798429723772015-02-20T14:26:49.111-08:002015-02-20T14:26:49.111-08:00@AK, it is best not to put anything in your web se...@AK, it is best not to put anything in your web server because you have to manage it through PeopleTools upgrades and synchronize it across load balanced web servers. Alternatives include placing on a separate, non-PeopleSoft web server or uploading all of the pieces into managed definitions in App Designer (or using the 8.53+ Branding objects component). The HTML can either be in a Pagelet Wizard pagelet or an iScript.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-21559233136222591292015-02-20T07:49:05.939-08:002015-02-20T07:49:05.939-08:00Hi Jim,
We are trying to embed online calculator ...Hi Jim,<br /><br />We are trying to embed online calculator in our PeopleSoft Portal Home page. I have java scripts,html,images style sheets provided. Where should i deploy these files in the web server to display the online calculator on the home page, any idea please?<br /><br />Thanks,<br />AKAnonymoushttps://www.blogger.com/profile/17572839615273095869noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-14691304040123415562014-08-11T09:55:26.761-07:002014-08-11T09:55:26.761-07:00@Ramee, technically, no, Ajax has no access to the...@Ramee, technically, no, Ajax has no access to the component buffer. It is possible to accomplish what you want, however, but is a hack you will have to verify each release. The way I would approach this is to inspect the PeopleTools Ajax request/response cycle when you click the button and then write JavaScript to replicate that request. You might even set a JavaScript/browser breakpoint on the button so you can see the PeopleCode that is called.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-81714089935695142892014-08-11T09:16:40.230-07:002014-08-11T09:16:40.230-07:00Previous conversation:
@Ramee/Ricky, yes you can u...Previous conversation:<br />@Ramee/Ricky, yes you can use Ajax (jQuery) to perform the calculation if the data exists in the database. What you would do is add an HTML Area to the grid with a button and some JavaScript to execute on click. This replaces your FieldChange. The JavaScript will make an Ajax request to an iScript to perform the calculation.<br /><br />If all of the data already exists on the page, the you can perform the calculation with JavaScript and skip ajax.<br /><br /><br />Hi Jim,<br />Thanks for inputs. Just few more questions:<br /><br />1) can we access the data from the component buffer/rowset through JavaScript? The reason is the calculations once field changes is based on values in the rowset and may not be not all be on the page.<br />2) Business say its difficult to click the button every time they change a field and there are 8 such field changes. Can we call the java script on change event?<br />3) Jquery when it fetches from database and we calculate the values and repopulate on the grid we would need to save the component so the next field change calculation gets the correct values am I correct here? If so can we trigger a save component via the java script?<br /><br />Thank you so much for your time and inputs.<br />Regards,<br />RameeRameehttps://www.blogger.com/profile/08711116645197198016noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-87922246430949876252014-08-04T10:55:50.126-07:002014-08-04T10:55:50.126-07:00@Sans, checkboxes have a checked property. Once yo...@Sans, checkboxes have a checked property. Once you have a reference to a checkbox, you can test its value by accessing the checked property. You can also uncheck it by setting checked = false. A great way to get a reference to a checkbox is to include jQuery or use querySelectorAll as in document.querySelectorAll("input[type='checkbox']").Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-48831667123066890402014-08-03T04:48:12.850-07:002014-08-03T04:48:12.850-07:00Hello Jim,
Wonderful insight into how to javascri...Hello Jim,<br /><br />Wonderful insight into how to javascript in peoplesoft. I have a requirement for which I have been struggling for a while.<br /><br />We have a grid; and one of the columns is check box. If user clicks check box on a row; I need to show a confirmation popup. If user hits Yes on the confirmations I need to continue with the actual fieldchange of the checkbox; and else if he hits cancel I need to undo the check/uncheck done by him.<br /><br />Some how controlling checkboxes had been tricky. Kindly help.Sans....Sayshttps://www.blogger.com/profile/15774971864791166597noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-64602719191603879072014-07-22T20:51:21.585-07:002014-07-22T20:51:21.585-07:00@Robert, I can't confirm, but I'm suspecti...@Robert, I can't confirm, but I'm suspecting that what you are experiencing is the asynchronous nature of scripts loaded AFTER the the DOM is ready. script tags are loaded synchronously while a document is loading, but asynchronously if appended as DOM elements in the manner you demonstrated. My recommendation was NOT to add "if" tests to the place where you want to include the library but rather to open up the library and modify it. Put that wrapper right in the library itself. Then you can put all the script tags you want into your code, but the script will only parse once. That is the way C header files work as well (ifdef, etc). You put the criteria in the header, not the place where you use the code.<br /><br />If you prefer to put the test in the location where you import the library, then I recommend using a script loader like <a href="http://www.dustindiaz.com/scriptjs" rel="nofollow">$script</a>. I like this one because it is light weight. If you minify it, you can embed it in one line. Another alternative is to create your own loader using either Ajax or a script tag event handler. The key is to make sure that your dependencies resolve in the correct order.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-32997336556425869162014-07-22T10:54:26.596-07:002014-07-22T10:54:26.596-07:00Hey Jim,
I tried to implement your recommendation...Hey Jim,<br /><br />I tried to implement your recommendation for @Jase and am running into issues.<br /><br />Before the fix you recommended, I had the following:<br /><br /><br /><br /><br /><br /><br />I pass in the libraries.<br /><br />I then commented out that code and replaced with the following:<br /><br /><br /><br />if(!window.jQuery)<br />{<br /> var s = document.createElement("script");<br /> s.src = "%bind(:1)";<br /> document.head.appendChild(s);<br /><br /> var t = document.createElement("script");<br /> t.src = "%bind(:2)";<br /> document.head.appendChild(t);<br />} else { <br />}<br /><br /><br />When I test, the initial load does not display the tree. When I click a JS button that initiates a fieldchange event, then the tree does display. Each time the JS button is clicked, the tree is refreshed.<br /><br />I thought the code above would initially load the tree and then when fieldchange is executed, it would not refresh.<br /><br />Any help is greatly appreciated.<br /><br />Thanks.Roberthttps://www.blogger.com/profile/17300211335388725103noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-41379150525682869332014-07-22T00:43:29.134-07:002014-07-22T00:43:29.134-07:00ok, great. Thanks.ok, great. Thanks.jasehttps://www.blogger.com/profile/07712134270807195241noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-16891731360193332052014-07-21T09:12:08.283-07:002014-07-21T09:12:08.283-07:00@Jase, that is true, and is an unfortunate side ef...@Jase, that is true, and is an unfortunate side effect of the way PeopleTools implemented "partial" page refresh (I put partial in quotes because I wonder how they define partial). Since the page does not reload, just the content through Ajax, any JavaScript objects attached to the window object will exist after a FieldChange event. For example, window.jQuery will exist both before and after.<br /><br />If you have an HTML Area that has jQuery, then jQuery will reload after every FieldChange. The trick I use is to wrap the jQuery library in this JavaScript: if(!window.jQuery) { jQuery lib content here }. I actually modify the jQuery JavaScript library file. I do the same with any jQuery plugins, but test for the existence of the plugin. I actually wrap ALL of my JavaScripts in this manner. It is sort of like C-style include protection, but for JavaScript.<br /><br />Another alternative is to place all of your code in a common HTML definition such as PT_PAGESCRIPT and then evaluate the URL to determine if PT_PAGESCRIPT is executing on your component. My PeopleTools Tips book has a chapter on creating a configurable version of this.<br /><br />The best alternative comes with PeopleTools 8.54. It is an online configuration page that allows you to inject any JavaScript into a component. You can do this globally or specify a component.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-28675500131455715312014-07-21T01:01:27.388-07:002014-07-21T01:01:27.388-07:00Hi Jim,
Love your work!
I have a page and on it I ...Hi Jim,<br />Love your work!<br />I have a page and on it I put some html, javascript and use a JQuery library. It all works, but when I click a button on the page which uses standard FieldChange, it repaints the whole page so all my HTML and javascript disappears. Do I need to do something special so that PeopleCode and HTML/Javascript can co exist ?<br />Thanks.jasehttps://www.blogger.com/profile/07712134270807195241noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-89510546436946029642014-07-17T07:07:48.627-07:002014-07-17T07:07:48.627-07:00@Robert, I think what you are experiencing is Peop...@Robert, I think what you are experiencing is PeopleSoft replacing the page's contents on FieldChange. I believe the "hack" would be to Monkeypatch net.ContentLoader to restore the state of the jTree. You can see examples of Monkeypatching net.ContentLoader in my posts <a href="http://jjmpsj.blogspot.com/2011/10/monkey-patching-peoplesoft.html" rel="nofollow">Mnkeypatching PeopleSoft</a> and <a href="http://jjmpsj.blogspot.com/2011/10/changing-search-page-operator.html" rel="nofollow">Changing the Search Page Operator</a>Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-64310844668089451252014-07-17T05:35:28.931-07:002014-07-17T05:35:28.931-07:00Hi Jim,
I have successfully added an HTML Area to...Hi Jim,<br /><br />I have successfully added an HTML Area to a page that uses jsTree to display a list of checkboes with multiple levels for a user to select.<br /><br />Once a user selects checkboxes from the jsTree, I am able to execute an iScript via a javascript button that sets the querystring with the users selected. Once the iScript has been executed, I get the list from the querystring and process accordingly.<br /><br />However, I am unable to add a PeopleSoft button to the page that calls a javascript to pull which checkboxes are selected. When the button is clicked, the jsTree is re-loaded and I lose the checkboxes that the user selected (even with using jsTree state property, I can't pull the selected checkboxes). I haven't been able to figure out how to stop the automatic refresh of the jsTree from loading when a PS button is clicked. This is the preferred method over iScript as I don't want the page to reload, nor do I want to add to the querystring. <br /><br />Any help is greatly appreciated. <br /><br />As always, thanks for your help and your blog is a fantastic help and resource!Roberthttps://www.blogger.com/profile/17300211335388725103noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-18788342890581782192014-07-14T12:12:55.288-07:002014-07-14T12:12:55.288-07:00@Ramee/Ricky, yes you can use Ajax (jQuery) to per...@Ramee/Ricky, yes you can use Ajax (jQuery) to perform the calculation if the data exists in the database. What you would do is add an HTML Area to the grid with a button and some JavaScript to execute on click. This replaces your FieldChange. The JavaScript will make an Ajax request to an iScript to perform the calculation.<br /><br />If all of the data already exists on the page, the you can perform the calculation with JavaScript and skip ajax.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-56553567637302366272014-06-25T19:16:44.542-07:002014-06-25T19:16:44.542-07:00Hi Jim,
I am on HRMS 9.1 and Tools 8.51. On the c...Hi Jim,<br /><br />I am on HRMS 9.1 and Tools 8.51. On the compensation page we have 3 grids at level 1 with almost 100 columns in total. <br />1) There are 2 issues one if the number of rows in the grid reaches more than 80 the page fails to load.<br />2) Out of the 100 fields in all the grids at most 5 to 6 fields are editable. If I load around 75 rows in each grid the page loads but on a grid field change there is minimal time taken up by appserver in contrast webserver rendering the page is having a processing time of 6 to 8 sec each for a field. <br /><br />The business user wants more than 100 rows to be displayed on the grid and also have the field change work within 3-4 sec.<br /><br />I am not sure how to approach the issue to show more than 100 rows in the grid without crashing the appserver, I am more interested in getting the field change work lot quicker. <br /><br />We have tried many options in the setting and cache and nothing helped. I have seen your post on Jquery, can I make the component differed and use a Jquery to mimic the calculation in the field change on the grid to avoid the appserver and webserver overhead?<br /><br />Please suggest,<br />Regards Ricky.Rameehttps://www.blogger.com/profile/08711116645197198016noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-67822473837251693342013-10-23T11:50:34.498-07:002013-10-23T11:50:34.498-07:00@Kevin, I like your approach of capturing the link...@Kevin, I like your approach of capturing the link click before it happens. Yes, you could use jQuery to identify and handle click events. Another alternative is to <em>monkeypatch</em> a method like saveWarning so it calls your save if the user chooses cancel. You will also want to monkeypatch the timeout so that it saves before timing out.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-26898266765424736372013-10-23T10:45:05.816-07:002013-10-23T10:45:05.816-07:00I really only want the onbeforeunload to happen if...I really only want the onbeforeunload to happen if the user clicks the back button. So I attempted to change the onclick event of the hyperlinks like this...<br /><br /><br />function adaptLinks() {<br /> var links = document.getElementsByTagName('a');<br /> for (i = 0; i != links.length; i++) {<br /> links[i].onclick = (function () {<br /> var origOnClick = links[i].onclick;<br /> return function (e) {<br /> window.onbeforeunload = function(){ };<br /> if (origOnClick != null && !origOnClick()) {<br /> return false;<br /> } <br /> }<br /> })();<br /> }<br />}<br />adaptLinks();<br /><br /><br /><br />This prevents the onbeforeunload and fires the onclick method associated with the link. I wonder if I could use jQuery or something cool like that to select all the input buttons and hyperlinks to override the onclick to blank out the onbeforeunload and call the default onclick event. Then change the onbeforeunload to ask the user if they want to navigate away from the page without saving. <br /><br />Thanks for you input!<br /><br />KevinKevin Weaverhttps://www.blogger.com/profile/09237087594753403371noreply@blogger.com