tag:blogger.com,1999:blog-34020393.post4930499208875885581..comments2024-03-27T10:59:38.307-07:00Comments on Jim's PeopleSoft Journal: Change the Advanced Search Page Default Search OperatorJim Marionhttp://www.blogger.com/profile/12995110203807924786noreply@blogger.comBlogger35125tag:blogger.com,1999:blog-34020393.post-27195524679532201702015-07-29T10:42:13.997-07:002015-07-29T10:42:13.997-07:00@Alan, the JavaScript above executes on the client...@Alan, the JavaScript above executes on the client, so you would want to add an HTML Area with the JavaScript. You will need to modify it a little bit to identify the prompt. Clicking the prompt button executes JavaScript. You just need to execute the same JavaScript. Use your browser's inspector tool to identify the JavaScript.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-19210221896699393192015-07-29T10:39:32.069-07:002015-07-29T10:39:32.069-07:00Jim,
If I wanted to do this for a lookup prompt, ...Jim,<br /><br />If I wanted to do this for a lookup prompt, and since no peoplecode executes for that, I could create a push button and subpage that resembles the prompt and search page then execute your java code from there?<br /><br />Thanks,<br />AlanAnonymoushttps://www.blogger.com/profile/08744862521129904441noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-42947182781213696142013-08-06T07:12:27.124-07:002013-08-06T07:12:27.124-07:00@Dennis, I don't have an easy answer for you. ...@Dennis, I don't have an easy answer for you. Like you, I would use Firebug to try to figure it out. You can try posting your question on the <a href="https://forums.oracle.com/community/developer/english/peoplesoft_enterprise/peoplesoft_general_discussion" rel="nofollow">PeopleSoft OTN General Discussion</a> forum.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-4310653517459442872013-08-05T16:56:11.205-07:002013-08-05T16:56:11.205-07:00Jim,
OK I give up. We have a function that paints...Jim,<br /><br />OK I give up. We have a function that paints a rectangle around grids (any object) based on an HTML object on the page. Works well most of the time but anytime I try to use the function and a sub-page is on the page where the HTML object is, the entire page gets distorted !! I have tried to use Firebug to determine where / when the HTML gets injected into the page and what is causing the distorted page. From you experience is there any easy way to determine what is causing the page distortion or how to go about determining what is causing it. This has been a problem for some time.<br /><br />Thanks in advance,<br />Dennis <br />I did not know if I should have started a new post for this question. Unknownhttps://www.blogger.com/profile/16917610341713024162noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-74221684146059954772013-07-30T15:42:56.057-07:002013-07-30T15:42:56.057-07:00Jim,
Thanks for all your time and I really don...Jim,<br /><br />Thanks for all your time and I really don't know how you find the time but I am glad you do !!!!!!!!!!<br /><br />Dennis Unknownhttps://www.blogger.com/profile/16917610341713024162noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-32603194220590075402013-07-30T14:11:52.951-07:002013-07-30T14:11:52.951-07:00@Dennis, I'm glad you like the book. I'm a...@Dennis, I'm glad you like the book. I'm also glad to hear you are trying something new. I'm always happy to hear about customers working outside the PeopleSoft box. It has nothing to do with PeopleSoft and its capabilities, but rather about learning and about satisfying business requirements in the most effective manner.<br /><br />You asked, "Does this variable need to be defined as global?" The answer is yes, and that is what I did (although it is not obvious). There is only one global object/scope/namespace, and that is window. Everything is a property of "window." If you don't control when and where your code will run, the best way to declare a global variable is just to attach it to window. In our case, the test window.xxx will return undefined because it hasn't been defined yet. This is good. That is exactly what you wanted to know. The other use is where we set a value: window.xxx = true. Now the "property" xxx is defined and has a value.<br /><br />At the global scope, a variable needs a var statement. But you don't want two var statements. If you don't control the runtime context or how often the code is run, you really can't control the var statement. Since all global variables are really just properties of "window" you can just reference it as a property of window and the JavaScript runtime is happy. Want to test this? Open a JavaScript console (Chrome or Firefox, hit the F12 key. IE has IE Developer Toolbar). Type this in the console:<br /><br />window.xxx<br /><br />You should see "undefined"<br /><br />Type:<br /><br />var xxx = true;<br /><br />Now type window.xxx<br /><br />You should see the value: true.<br /><br />In regards to using jQuery for what you are doing... I would do it the way you are doing it, except I would also check for the existence of a #ICSearch: document.getElementById("#ICSearch"). This will tell you whether or not you are on a search page. With ID selectors, jQuery is just calling document.getElementById anyway. Your way is faster.<br /><br />One other thing: global namespace pollution. Yes, add a global variable or two, but be careful not to create too many. I usually add an object to the global namespace (property of window), and then attach all my variables as properties of that object. If you are interested, and everyone writing JavaScript should be interested, then perform a Google search for <a href="https://www.google.com/search?q=javascript+global+namespace+pollution" rel="nofollow">JavaScript Global Namespace Pollution</a>.<br /><br />By the way, I'm glad you have a working solution. Great stuff!Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-35153401510770208372013-07-30T11:38:53.516-07:002013-07-30T11:38:53.516-07:00Jim,
I believe I have it working using you soluti...Jim,<br /><br />I believe I have it working using you solution but I would rather have done this using jQuery. I have been able to load jQuery into the system using the methods described in your book (message catelog) but was not able to get this working. Is this a quick change to the existing code below<br />objnk = document.getElementById("CG_JPM_SCH_VW_TR_DESCR5$op");<br /> if (objnk)<br />if (!globalChangeSeearch) {<br />{<br />for(i=0;i<objnk.length;i++)<br />{<br />if(objnk.options[i].value == "8")<br />{<br />objnk.selectedIndex = i;<br />}<br />}<br />}<br />} else { globalChangeSeearch = true;<br />}<br />I defined the globalChangeSeearch as a global variable and put code into PT_COMMON. <br /><br />Again, thanks for you time,<br />Dennis <br />Unknownhttps://www.blogger.com/profile/16917610341713024162noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-3979814926347559042013-07-30T10:20:38.395-07:002013-07-30T10:20:38.395-07:00Jim,
Thanks for your reply , much appreciated and...Jim,<br /><br />Thanks for your reply , much appreciated and thanks for a great book. The trigger for the code is just the load of the search page (not wrapped in a JavaScript event handler). Again very new to all of this but really enjoy learning new technologies. Quick question: when you say (!window.xxxRunOnceDone) does this variable need to be defined as global ?<br /><br />Thanks is advanced,<br />Dennis Unknownhttps://www.blogger.com/profile/16917610341713024162noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-55621189989806134722013-07-30T08:25:55.631-07:002013-07-30T08:25:55.631-07:00@Dennis,
What is your trigger for that code? Is t...@Dennis,<br /><br />What is your trigger for that code? Is this just bare JavaScript or is it wrapped in a JavaScript event handler function? If it is bare, that is probably fine.<br /><br />It sounds like your JavaScript reloads when any value is changed (drop-down). A reload can happen from the Ajax requests triggered by changes on the search page.<br /><br />Since the search page only loads once, and then uses Ajax to update values, etc, you can wrap your JavaScript in a conditional so it only fires once:<br /><br />if (objnk) {<br />if (!window.xxxRunOnceDone) {<br />// code goes here<br />} else {<br />window.xxxRunOnceDone = true;<br />}<br />}Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-20343974050397941582013-07-30T05:19:57.327-07:002013-07-30T05:19:57.327-07:00Jim,
Very new to javascript and jquery and trying...Jim, <br />Very new to javascript and jquery and trying to implement changing the advanced search page operator to 'contains'. Tried jQuery without too much success so did the following using javascript<br />changed expandSearchCriteria in PT_COMMON <br /> objnk = document.getElementById("CG_JPM_SCH_VW_SCHOOL_CODE$op"); <br /> if (objnk)<br />{<br />for(i=0;i<objnk.length;i++)<br />{<br />if(objnk.options[i].value == "8")<br />{<br />objnk.selectedIndex = i;<br />}<br />}<br />}<br />This function not only gets called when we click on prompt button but it gets called when we change a search criteria or when we click on any button on the lookup page (Lookup, clear etc). So it is all good if we don't change this default criteria. But if you change the default criteria from ‘contains’ to something else (say begins with) once you are in the lookup page and click on Lookup button, it will again reset the search criteria back to ‘contains’. I need to find out a way to fire this code only once when I click on prompt button or I need to find out some other function which gets executed only when a prompt button is clicked. <br />Thanks in advance<br />DennisUnknownhttps://www.blogger.com/profile/16917610341713024162noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-92179748264964881692010-10-28T08:05:36.687-07:002010-10-28T08:05:36.687-07:00@Pressure, using the inspector tool in Firebug, yo...@Pressure, using the inspector tool in <a href="PT_PROMPT_LOOKUP" rel="nofollow">Firebug</a>, you can hover over the magnifying glass to see the src attribute. From there you will see that the image name is PT_PROMPT_LOOKUP_dddd.gif. The _dddd suffix is a number to "trick" browser caching. Based on the name (and the fact that tools stores most images in app designer image definitions), you can assume that the PT_PROMPT_LOOKUP image is an image definition in app designer. You can prove it by looking for the image in app designer. I did this and found that image in app designer. Now that you know this, you can change the image on a global basis by updating the image definition in app designer. After making this change, I suggest you clear your web server cache and restart your web server.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-84990901441728323762010-10-28T06:32:18.537-07:002010-10-28T06:32:18.537-07:00This question is not regarding this but I have a s...This question is not regarding this but I have a small question. Is it possible to change lookup prompt image on a particular field(from glass image to my own custom image) . And also in grids/scrolls for next/previous and add and delete we can change the image but generally leave it to *use default image* , just want to know where do I change this default image so that its effective everywhere in the system. thanks in advance.Mysha(Hazel)https://www.blogger.com/profile/15370930732252344599noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-40077277887366474832010-04-20T16:23:58.622-07:002010-04-20T16:23:58.622-07:00@Dan, unfortunately, I have not worked with it.@Dan, unfortunately, I have not worked with it.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-19550039703289807912010-04-20T15:39:33.081-07:002010-04-20T15:39:33.081-07:00Jim
Do you have any experience using the jQuery v...Jim<br /><br />Do you have any experience using the jQuery validate plugin to do client-side validation in PeopleSoft? I've played with it a bit with no success. I can get the validation to run but it does not seem to catch my errors.<br /><br />Cheers<br />DanDanhttps://www.blogger.com/profile/15502251805949478749noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-17619276457205854082010-04-20T10:46:52.673-07:002010-04-20T10:46:52.673-07:00@Cory, cool. Thank you for the update.@Cory, cool. Thank you for the update.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-40296025547533196602010-04-20T10:29:55.917-07:002010-04-20T10:29:55.917-07:00That did it. I parsed it out, used the envt name,...That did it. I parsed it out, used the envt name, and then only had it execute on the specific page for that field. I really appreciate your help. Cant wait for the book!Cory Uhrichhttps://www.blogger.com/profile/14848149319283721657noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-66092492864517358002010-04-20T09:32:21.257-07:002010-04-20T09:32:21.257-07:00Yes, place it in the existing js.Yes, place it in the existing js.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-41811200406202651682010-04-20T08:45:54.223-07:002010-04-20T08:45:54.223-07:00Yes, we are placing them in a sub directory of app...Yes, we are placing them in a sub directory of applications/peoplesoft/PORTAL.<br /><br />Can I just use the existing .js and put in the regular expressions in there?<br />ThanksCory Uhrichhttps://www.blogger.com/profile/14848149319283721657noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-48304417830641424072010-04-15T11:11:47.022-07:002010-04-15T11:11:47.022-07:00@Cory, from your post, it looks like you are still...@Cory, from your post, it looks like you are still using a relative URL (no server name), but you had to put in the env name (HRDV). Is this because you are using a reverse proxy or because you are placing these files in a sub directory of ../applications/peoplesoft/PORTAL/?<br /><br />To work around the URL issue, I use regular expressions to parse strCurrUrl or window.location.pathname... actually, that is what I'm doing <a href="http://jjmpsj.blogspot.com/2009/08/javascript-complement-of-peoplecode.html" rel="nofollow">here</a>, but for different pieces of the URL.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-68304001697557437482010-04-15T10:43:59.848-07:002010-04-15T10:43:59.848-07:00That did it! Awesome. (We are on 8.49) Fiddler sh...That did it! Awesome. (We are on 8.49) Fiddler showed 404 errors on my custom *.js files, so I found that if I put in the environment name in the path it worked.<br />/HRDV/scripts/jquery-1.4.2.min.js<br /><br />Problem is I don't want to have to hard code environment names in the path for each webserver in my js files. Any ideas on how to get around that?<br /><br />Next step now is to make it specific to the component and page. <br /><br />Thanks again for your patience and help with this.Cory Uhrichhttps://www.blogger.com/profile/14848149319283721657noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-66468256381240347232010-04-15T09:28:08.708-07:002010-04-15T09:28:08.708-07:00@Cory, it sounds like you are getting this figured...@Cory, it sounds like you are getting this figured out. I am sorry you have to struggle through it. My book devotes a few hundred pages to these topics :)<br /><br />Yes, document.write is how you inject code while the page is loading. Yes, the example is half way down the post <a href="http://jjmpsj.blogspot.com/2009/01/injecting-javascript-libraries-into.html" rel="nofollow">Injecting JavaScript Libraries into PeopleSoft Pages</a>. To inject the code on this page, place the code in a static *.js file on your web server, just like your jQuery file and then add this line immediately following your jQuery injection line:<br /><br />document.write("<scr" + "ipt id='xxx_ui_search_op' " + "src='/scripts/name_of_searchop.js'><\/script>");<br /><br />When you save the JavaScript, just remove the <script> HTML tag wrapper. Since it is a .js file, you can't include HTML tags.<br /><br />If you are unsure as to whether your injection is working, Try using Firefox and Firebug, Chrome, or Safari. These three browsers show resource downloads and have a JavaScript console that allows you to type things like $ and see results. Fiddler is also a very good tool for inspecting downloads. So, to see if injection is working, the first thing you need to do is see if your browser is downloading jQuery and your additional search page script. Fiddler, Firebug, Chrome, and Safari will show this. If injection is working, you will see an http request for the file.<br /><br />Next is to test if your browser is interpreting the injected JavaScript. To test this, change your URL from .../psp/... to .../psc/... and then type $ or window.jQuery into the JavaScript console. This will tell you if jQuery is working.<br /><br />Once that is working, navigate to your advanced search page and copy/paste the part inside the $(document).ready into the JavaScript console.<br /><br />Oh, one more thing. Are you using PeopleTools 8.50? This code doesn't work on 8.50. My book has code for 8.50, but I haven't posted it on my blog yet. I'm working on a post for that. Hopefully that is not the case for you.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-71710877298570610992010-04-15T09:10:23.733-07:002010-04-15T09:10:23.733-07:00Ok, I now have jQuery on the server and I injected...Ok, I now have jQuery on the server and I injected the library, but now am trying to inject the above script without success. Do you have an example on how to inject the above code? Thanks again!Cory Uhrichhttps://www.blogger.com/profile/14848149319283721657noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-15765486008895328442010-04-15T08:00:39.406-07:002010-04-15T08:00:39.406-07:00This comment has been removed by the author.Cory Uhrichhttps://www.blogger.com/profile/14848149319283721657noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-34502171899777143732010-04-15T07:59:03.598-07:002010-04-15T07:59:03.598-07:00This comment has been removed by the author.Cory Uhrichhttps://www.blogger.com/profile/14848149319283721657noreply@blogger.comtag:blogger.com,1999:blog-34020393.post-31967107747043846802010-04-14T15:05:02.680-07:002010-04-14T15:05:02.680-07:00@Cory, A couple of issues:
1. PT_COPYURL is JavaS...@Cory, A couple of issues:<br /><br />1. PT_COPYURL is JavaScript, not HTML. This means you can't put <script> tags in it. To include additional JavaScript, you have to inject as described in my post on JavaScript injection.<br /><br />2. If you inject a JavaScript library and want to execute JavaScript that depends on that injected JavaScript, you have to inject it as well. Otherwise, the remaining JavaScript will execute before the library is loaded.<br /><br />If you do not have access to your web server, you can place both of these (your JavaScript and jQuery) in message catalog definitions and serve them from an IScript.<br /><br />Yes, you can use the hosted jQuery instead of hosting your own copy. I don't like this solution because it gives someone else direct access to your page content.Jim Marionhttps://www.blogger.com/profile/12995110203807924786noreply@blogger.com