Quantcast
Channel: Jim's PeopleSoft Journal
Viewing all articles
Browse latest Browse all 201

Changing the Search Page Operator

$
0
0

I just posted about Monkey Patching, a technique used in chapter 7 of my book PeopleTools Tips and Techniques to set the default search page operator on advanced search pages (Note: only 8.50 and later required Monkey Patching). As I was looking over the "Changing Search Operators" section of chapter 7, I noticed the code was missing a few lines (pages 293 - 296). Here is my revision:

<scripttype="text/javascript">
//Cstyleincludeprotection
if(!window.apt.setSearchOp){
window.apt.setSearchOp =true;

if(window.net){
//pt8.50
(function($){
var originalContentLoader = net.ContentLoader;
net.ContentLoader =function(url,form,name,method,onload,onerror,params,contentType,bAjax,bPrompt){
var originalOnLoad = onload;
if(name =="#ICAdvSearch"){
onload =function(){
if(typeof originalOnLoad =="undefined"||!originalOnLoad){
this.processXML();
}else{
originalOnLoad.call(this);
}

//Thevaluefor"between"is9.Changethistoyourdesired
//searchoperatorvalue.
var newValue =9;

//ThenameofthesearchkeyfieldisAPT_UI_SCRIPTS_MENUNAME.
//Generallyspeaking,PeopleSoftcreatesHTMLelementnamesby
//combiningrecordandfieldnameswithanunderscoreasin
//RECORD_FIELD.Changethefollowingvaluetothenameofyour
//searchkeyrecord_field
var coll = $("select[name='APT_UI_SCRIPTS_MENUNAME$op']");
if(coll.val()!= newValue){
coll.val(newValue).change();
}
}
}
returnnew originalContentLoader (url,form,name,method,onload,onerror,params,contentType,bAjax,bPrompt);
}
})(window.jQuery);
}else{
//pt8.4x,$(document).readybelowwillhandlept8.4x
}

//justincaseadvancedistheinitialview
$(document).ready(function(){
var newValue =9;
var coll = $("select[name='APT_UI_SCRIPTS_MENUNAME$op']");
if(coll.val()!= newValue){
coll.val(newValue).change();
}
});
}
</script>

Viewing all articles
Browse latest Browse all 201

Trending Articles