tag:blogger.com,1999:blog-34020393.post4509029079283815818..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: jQuery Plugin Include ProtectionJim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger29125tag:blogger.com,1999:blog-34020393.post-20836577224298384492016-11-06T21:47:27.674-08:002016-11-06T21:47:27.674-08:00Hi Jim,
I am facing a jQquery issue only in Chrom...Hi Jim,<br /><br />I am facing a jQquery issue only in Chrome when I fire it from PS Modal window.<br />It's working find in all other browsers from Peoplesoft except chrome.<br />It's working fine externally out side of Peoplesoft page including Chrome.<br /><br />Any help is appreciated.<br /><br /><br />Below is my js.<br /><br />script type="text/javascript"<br /> function loadjscssfile(filename, filetype){<br /> if (filetype=="js"){ //if filename is a external JavaScript file<br /> var fileref=document.createElement('script')<br /> fileref.setAttribute("type","text/javascript")<br /> fileref.setAttribute("src", filename)<br /> }<br /> else if (filetype=="css"){ //if filename is an external CSS file<br /> var fileref=document.createElement("link")<br /> fileref.setAttribute("rel", "stylesheet")<br /> fileref.setAttribute("type", "text/css")<br /> fileref.setAttribute("href", filename)<br /> }<br /> if (typeof fileref!="undefined")<br /> document.getElementsByTagName("head")[0].appendChild(fileref)<br /> }<br /><br /> loadjscssfile("http://apply.resumemirror.com/css/easyapply.css","css");<br /> /script<br /> script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"> /script<br /> script type="text/javascript" src="https://apply.resumemirror.com/js/jquery.simplemodal-1.3.5.js">/script<br /><br />style<br />#simplemodal-container[style] {<br /> position:relative;<br /> height: 500px;<br /> width: 900px;<br /> }<br />/style<br />style<br />#simplemodal-container[style] iframe{<br />position:absolute;<br /> height: 500px;<br /> width: 900px;<br />}<br />/style<br /><br /><br />script type="text/javascript"<br />var Frame = "iframe src='http://nfl.com' scrolling='No' marginwidth='0' marginheight='0' hspace='0' vspace='0' style='border-style: none;'/iframe";<br />var modalRan = 0;<br /><br />$(document).ready(function() {<br /> if (modalRan == 0) {<br /> modalRan=1;<br /> $.modal(Frame.valueOf(),{<br /> autoResize:true<br /> });<br /> }<br />});<br />/scriptAnonymoushttps://www.blogger.com/profile/04436227293795697101noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-86803628913939447562015-05-11T13:08:43.222-07:002015-05-11T13:08:43.222-07:00@Arpan, did you right-click on the element and ins...@Arpan, did you right-click on the element and inspect the HTML? That is the only way to know for sure.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-47685587467349779492015-05-11T10:09:46.120-07:002015-05-11T10:09:46.120-07:00Hi Jim,
Thanks for your reply. But it's not a...Hi Jim,<br /><br />Thanks for your reply. But it's not an issue with record_field naming convention. Could you please provide some sample code.Anonymoushttps://www.blogger.com/profile/02055440736320033940noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-6135462329531627092015-05-11T10:00:24.345-07:002015-05-11T10:00:24.345-07:00@Arpan, the easiest way to find the ID is to right...@Arpan, the easiest way to find the ID is to right-click on the element and choose inspect to view it in the browser's inspector. Typically fields have the record_field naming convention, but there are exceptions.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-51005598059473033242015-05-11T09:57:35.898-07:002015-05-11T09:57:35.898-07:00Hi Jim,
Thanks for your great posts over the year...Hi Jim,<br /><br />Thanks for your great posts over the years.<br /><br />I am trying my hands on Jquery recently(Watermark on field) and I am stuck with a small issue.<br /><br />The issue here is how to refer a PeopleSoft page field in a Jquery code?<br /><br />Below is a sample watermark code:<br /><br /><br /><br /><br /><br />$(document).ready(function() {<br />$(".PSLONGEDITBOX").attr("placeholder","Please review the page.");<br /><br /><br /><br />Here instead of ".PSLONGEDITBOX" I want to pass field name.<br /><br />I tried with recordname_fieldname; but didn't work. Could you please put some light on it.<br /><br />P.S: all my fields are on level 0.Anonymoushttps://www.blogger.com/profile/02055440736320033940noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-14845747441906487192013-07-17T09:25:10.246-07:002013-07-17T09:25:10.246-07:00@Nagaraj, I am not sure what is causing this. Is d...@Nagaraj, I am not sure what is causing this. Is defineProperty part of your code or is it from a jQuery plugin? Perhaps you can place some debug code around it? Are you using the IE Developer Toolbar?Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-58192106566056586222013-07-17T08:31:39.105-07:002013-07-17T08:31:39.105-07:00Hi Jim,
I am creating a context menu in all Peopl...Hi Jim,<br /><br />I am creating a context menu in all PeopleSoft pages using Jquery. I have been successfull when I test the pages in Firefox or Chrome browsers. However in Internet Explorer (8,9,10) version i keep getting error "SCRIPT438: Object doesn't support property or method 'defineProperty' ". Because of this error my other custom javascript files errors out probably. I have tried all Jquery version but have not been successful. The only version were I am able to get my context menu working in IE is 1.8.2 but again here too the context menu does not show up as it was showing up in the Firfox or Chrome. Do you have any idea on how to resolve this.<br /><br />Thanks<br />NagarajNagaraj Nagavarpuhttps://www.blogger.com/profile/10640269139103253787noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-90611804290774624842013-05-06T17:52:58.881-07:002013-05-06T17:52:58.881-07:00Thanks for your insight Jim. I will recommend look...Thanks for your insight Jim. I will recommend looking into the $(document).ready problem. One of the errors I've seen could be the result of that.<br /><br />DanDanhttps://www.blogger.com/profile/15502251805949478749noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-11080577824141124632013-05-06T17:32:48.182-07:002013-05-06T17:32:48.182-07:00@Dan, as always, it is good to hear from you. No, ...@Dan, as always, it is good to hear from you. No, PeopleSoft is not using Prototype. In fact, 8.53 now ships with jQuery and jQuery UI. It is an older version and it isn't used by regular transaction pages (yet?), but it is now delivered as HTML definitions.<br /><br />I would need more information, but just FYI, I use jQuery with 8.53 with no issues. When I switched from 8.49 to 8.50, I had to work through the fact that $(document).ready doesn't fire on transaction pages because the content is ajax'd into the browser (It didn't work on 8.50 anyway).Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-59040083917352795822013-05-06T17:11:39.303-07:002013-05-06T17:11:39.303-07:00Jim
We are upgrading our PeopleTools from 8.49 to...Jim<br /><br />We are upgrading our PeopleTools from 8.49 to 8.53. I wrote a lot of jQuery JavaScript to improve the user experience in our self-service modules running in 8.49. I've moved on and another team is dealing with the upgrade. They are having some problems with the JavaScript in 8.53. I'm wondering if you are familiar with any conflicts between jQuery and the delivered 8.53 JavaScript?<br /><br />One person on that team has theorized that PeopleSoft is now using prototype.js and that there are known conflicts with jQuery. I've seen nothing to indicates that prototype.js is being used.<br /><br />I'm tied up with other work, so don't know the details of the problems, but may have to dig in myself at some point to see what is going on.<br /><br />Thanks for any help.<br />Cheers<br />DanDanhttps://www.blogger.com/profile/15502251805949478749noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-52357604649494162472013-04-30T20:31:13.631-07:002013-04-30T20:31:13.631-07:00@Chris, right, just because you can, doesn't m...@Chris, right, just because you can, doesn't mean you should. In Part II of my <a href="http://www.amazon.com/PeopleSoft-PeopleTools-Techniques-Oracle-Press/dp/0071664939/" rel="nofollow">PeopleTools Tips</a> book I show how to insert scripts into pages. It works the same in iframes (as long as they don't violate the domain of origin policy). Here is the JavaScript:<br /><br />apt.files.importScript = function(parms) { <br /> var s = document.createElement("script"); <br /> s.type = "text/javascript"; <br /> s.src = parms.url; <br /> s.id = parms.id; <br /> s.defer = (parms.defer) ? parms.defer : false; <br /> document.getElementsByTagName("head")[0].appendChild(s); <br />}<br /><br />Just replace the document references with the document inside the iframe.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-19309109272388848302013-04-30T19:51:37.792-07:002013-04-30T19:51:37.792-07:00I've done CSS injection into the component iFr...I've done CSS injection into the component iFrame using JS to add another Link element to the head section. What might one need to consider in trying a similar approach with a script element? Needs a path, like to jquery on a server, or something else. Not quite the same as CSS, since style sheets are cached and we can get the URL via PeopleCode.<br /><br />There are always little nuances to these nifty tricks. Just because one can doesn't mean one should, eh?<br /><br />Cheers,<br /><br />ChrisChris Couturehttps://www.blogger.com/profile/09878051317203041479noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-55203061346544973022013-04-29T10:32:58.018-07:002013-04-29T10:32:58.018-07:00@Chris, Thanks I was able to get Raphael JS workin...@Chris, Thanks I was able to get Raphael JS working in PS environment. Issue was with my function being called by window.onLoad(). I called the function directly from the pagelet and it worked.<br /><br />GaryAnonymoushttps://www.blogger.com/profile/13417851545537584894noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-53134990867217581292013-04-29T05:29:08.281-07:002013-04-29T05:29:08.281-07:00@Chris, I have jQuery in my header as well. The pr...@Chris, I have jQuery in my header as well. The problem with this approach is that it doesn't help with Pagelet Wizard. Yes, if I put jQuery in the header, then Pagelet Wizard pagelets on the homepage will be able to use it, but Pagelet Wizard won't use it in the Pagelet Wizard itself. This is because of the separation of the header and component pages through frames and is why I put jQuery in my pagelet HTML and XSL as well.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-33484621518372722612013-04-28T13:20:51.208-07:002013-04-28T13:20:51.208-07:00Hi Jim,
Any reason not to put the JS path in the ...Hi Jim,<br /><br />Any reason not to put the JS path in the header? I do it regularly as I'm usually doing alternate templates for homepage to get the look I want. In cases where only an HTML override is used I call JS from a directory on the web server. If I'm doing a WEBLIB-based template I can get JS from the database (as an HtML definition). <br /><br />Another approach is to put a "hidden" pagelet on the page, where the pagelet contains a URL or source code. I think it's rather hack-ish but it works in a pinch. <br /><br />Gary - though I've not done Raphael work directly I have seen it used in PS in production. It is definitely do able. <br /><br />ChrisChris Couturehttps://www.blogger.com/profile/09878051317203041479noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-76639873161602109632013-04-24T10:30:51.073-07:002013-04-24T10:30:51.073-07:00@Gary, no, I haven't looked into Raphael.@Gary, no, I haven't looked into Raphael.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-75969577089600214352013-04-24T10:14:40.449-07:002013-04-24T10:14:40.449-07:00Jim,
Just wondering if you have you tried to get ...Jim,<br /><br />Just wondering if you have you tried to get Raphael.js to work in a PS environment. I tried to created some dashboard using Raphael but nothing returned. I'm sure the Raphael library was loaded, I could see the code in Firebug, but just got no results back.<br /><br />Thanks GaryFoggyRiderhttps://www.blogger.com/profile/00175241346653565372noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-18323065944500579912013-04-19T13:33:57.868-07:002013-04-19T13:33:57.868-07:00@Justin, this post applies to the jQuery and jQuer...@Justin, this post applies to the jQuery and jQuery UI files directly, not to the HTML that inserts the HTML. From what you posted in the comments, your jQuery is actually hosted by the Google Ajax API's/CDN, so you can't modify the files to take advantage of what I mentioned in this post. To apply "include protection," download the jquery files, modify them according to this post, place them in a location where your browser can access them (your PeopleSoft web server, etc), and then update your HTML to point to your versions of the JavaScript libraries.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-88560487609804178632013-04-18T13:47:07.353-07:002013-04-18T13:47:07.353-07:00Hi Jim-
Trying to apply your fix and for the life...Hi Jim-<br /><br />Trying to apply your fix and for the life of me can't get it to work. Still pretty green with javascript and jQuery. Here's the java calls that I'm using:<br /><br />script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">/script> <br />script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js">/script> <br />script type="text/javascript"><br />$(document).ready(function() {<br />$("#demo_myHrLinks").accordion({ <br /> heightStyle: "content", <br /> active: false, <br /> collapsible: true, <br /> header: 'h3', <br /> disabled: false,<br /> animated: 'bounceslide' });<br />});<br />/script><br />I currently have this in the head. When I try to wrap your if statement, I see the statement in my pagelet. Help as to where to place it?<br /><br />Thanks<br />JustinAnonymoushttps://www.blogger.com/profile/03167714624295653439noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-7195578251898330382013-04-15T09:19:39.623-07:002013-04-15T09:19:39.623-07:00@Randy, what type of content? Is it query content?...@Randy, what type of content? Is it query content?Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-85351104067761588632013-04-15T09:10:26.968-07:002013-04-15T09:10:26.968-07:00I did buy your book last week, great information. ...I did buy your book last week, great information. I have a question. In our Interaction Hub (9.1, 8.52.07) we have content from HCM and Financials and it's working well. We have a go-live coming up for a large group of self service users. When the content is rendered there is a return link that we would like to remove. Can you point me to what might drive that return link and how to remove it from the the HCM and Financials content? Thanks in advance.Anonymoushttps://www.blogger.com/profile/18074407980957963500noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-45206478158744219422013-04-07T22:27:31.412-07:002013-04-07T22:27:31.412-07:00@James, I was just looking at my collaborate sched...@James, I was just looking at my collaborate schedule for tomorrow and I see you have a session in the morning. I look forward to seeing you there!Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-47623306646293530262013-04-07T08:27:21.918-07:002013-04-07T08:27:21.918-07:00@James, thank you for sharing. This is a very good...@James, thank you for sharing. This is a very good approach because it keeps the browser from attempting to read all that JavaScript multiple times. For sites using Pagelets with a PeopleToos 8.49 Portal and earlier, your recommendation is better than mine. The reason I qualify the PeopleTools release is because later versions of PeopleTools (8.50 or 8.51... can't remember which) switched from delivering a server-side assembled homepage to a client-side assembled homepage. The 8.5+ homepage contains pointers to pagelets and uses Ajax to parallel load pagelet content after the homepage loads. document.write is a great strategy for loading JavaScripts when a page is loading because of its blocking nature. I recommend this approach in my PeopleTools Tips book. After a page loads, however, document.write will actually replace the page. The way PeopleTools 8.5+ handles this is to check for pagelets using document.write, and then force a full homepage non-Ajax reload.<br /><br />The document.write strategy with a PeopleSoft portal is great for 8.49 and earlier, but may cause performance problems with later versions of PeopleTools because it causes the homepage to stop processing and reload. You can see this in action by creating a simple HTML pagelet that has the following script:<br /><br />[script type="text/javascript]<br />document.write("Hello World!");<br />[/script]<br /><br />When a PeopleTools 8.50 (or was it 8.51...) portal loads this pagelet, as soon as it hits document.write, the whole homepage will reload in "classic" mode without Ajax.<br /><br />I discovered this "feature" after a PeopleTools upgrade. I had some user homepages that would "flicker" (load part way, then reload) and I wasn't sure why. I had pagelets that used document.write, which was causing a full homepage refresh. This behavior makes it so document.write continues to work, it just doesn't perform as well.<br /><br />How does SharePoint handle this? Does it serve a fully loaded homepage with all WebParts and WebPart content or does it use Ajax to fetch WebPart content in parallel/asynchronously after the homepage loads?Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-70038177072903766682013-04-06T09:19:05.544-07:002013-04-06T09:19:05.544-07:00Hi Jim,
Long-time reader, first-time commenter (t...Hi Jim,<br /><br />Long-time reader, first-time commenter (though I believe we've been on at least one or two conference calls / e-mail threads together, through Matt).<br /><br />I wanted to share the basics of the code we use to overcome this same problem within InFlight.<br /><br />SharePoint's Web Parts on a container page are very much akin to PS pagelets -- autonomous and (for all intents and purposes) unaware of each other when they're rendered.<br /><br />So, like you, we aim to load jQuery and the plugins once and only once.<br /><br />Here's the code that would go inside each pagelet: (tags are in [] instead of <>)<br />[script type='text/javascript']<br /> if (typeof INFLIGHT_LOADER_EXISTS == 'undefined') { <br /> document.write('[script src="/InFlight/Common/js/InFlightAssetLoader.min.js"][\/script]'); <br /> }<br />[/script]<br />[script type='text/javascript']<br /> InFlightLoadFile('/path/to/resource.1.js'); // e.g. plugin #1<br /> .<br /> .<br /> .<br /> InFlightLoadFile('/path/to/resource.N.js');<br />[/script]<br /><br /><br />Here's the simplified edition of the InFlightAssetLoader.js... It can be modified to support whatever flavor of lazy loading you like (though document.write has proven consistently successful for us). Also, the real script does things like allowing you to write into different spots within the DOM, but I wanted to keep this simple. The basic structure is here:<br /><br />var INFLIGHT_LOADER_EXISTS = true; // note that in a real implemetation, variables like this should be namespaced, not global<br />var InFlightLoadedFiles = [];<br />var JQUERY_FILE = "/InFlight/Common/js/jquery.min.js";<br />var INFLIGHT_CSS = "/InFlight/Common/css/InFlightHelperStyles.css";<br />InFlightLoadFile(JQUERY_FILE);<br />InFlightLoadFile(INFLIGHT_CSS);<br />function InFlightLoadFile(filePath, args) {<br /> // Isolate the file name and extension<br /> var fileName = filePath.replace(/^.*(\\|\/|\:)/, '');<br /><br /> if (InFlightLoadedFiles[fileName] == null) {<br /> // Detect if we're trying to add jQuery itself and<br /> // look to see if the jQuery() function already exists<br /> var REjQ = /jquery(?:\-(\d|\.)*)?(?:\.min)?\.js/;<br /> var skipLoad = false;<br /> if (REjQ.test(fileName)) {<br /> skipLoad = (typeof jQuery != 'undefined');<br /> }<br /> <br /> if (!skipLoad) {<br /> // We haven't loaded this script yet, so load it<br /> var REext = /(?:\.([^.]+))?$/;<br /> var ext = REext.exec(fileName)[1];<br /> var isCSS = (ext === 'css');<br /> if (isCSS) {<br /> document.write("[link rel='stylesheet' type='text/css' href ='" + filePath + "' /]");<br /> } else {<br /> document.write("[script type='text/javascript' src ='" + filePath + "'][\/script]");<br /> }<br /> InFlightLoadedFiles[fileName] = true;<br /> }<br /> }<br />}<br />James La Brashhttps://www.blogger.com/profile/10992362108783037371noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-41164262482354809842013-04-05T08:23:15.229-07:002013-04-05T08:23:15.229-07:00@Lakshminarayana, the submitAction call in the but...@Lakshminarayana, the submitAction call in the button click is a JavaScript form post. There are two ways to execute this code. The first is using jQuery selectors and <a href="http://api.jquery.com/click/" rel="nofollow">.click()</a> to trigger the original button's click. The second is to call the exact same code from your event handler. If you hide the navigation buttons within the grid's or scroll's properties, I'm not sure if the JavaScript will still work. This will perform an Ajax form post and reload the grid based on the Ajax response.<br /><br />I also thought there were PeopleCode methods or functions for switching pages in a scroll. Worst case, I thought you could set the active row using PeopleCode in a FieldChange event.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.com