Tuesday, October 29, 2013

Hide Go button in OBIEE 10G and create custom go button

===============Hide Go Button javascript==========================
<style type="text/css">
.GFPSubmit {display: none;}
</style>

===================Go Button js===================================
<center>
<script>
nqdfmt = 'mmddyy';
function GFPDoFilters_samvi(sViewID, tTable, bGFPReloadInline){
// RIE: calling GFPDoFilters in preview mode
// doesn’t do anything so we are going to just return
if(sViewID==ksGFPStatePath)
return;
var tExpr = XUICreateElement(saw.xml.kSawxNamespace, 'expr');
tExpr.setAttribute("xsi:type", "sawx:logical");
tExpr.setAttribute("op", "and");
for(var h=0; h<tTable.length; ++h)
{
var tPromptCells_New = tTable[h].getElementsByTagName("TD");
for(var i=0; i<tPromptCells_New.length; ++i)
{
var tElement = tPromptCells_New[i];
if(tElement.getAttribute("GFPBuilder") != null)
{
try
{
var tFilter = eval(tElement.getAttribute("GFPBuilder"));
if(tFilter)
{
tExpr.appendChild(tFilter);
}
}
catch(e)
{
alert('xxxx '+e);
return;
}
}
}
}
var tDelayedDash = document.getElementById("sawDashboardDelayed");
if(tExpr.childNodes.length==0 && !document.getElementById("sawDashboardDelayed"))
return false;
else if(tExpr.childNodes.length==0)
tExpr = null;
else if(tExpr.childNodes.length==1)
tExpr=tExpr.childNodes[0];
if(tExpr)
{
tExpr.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
}
// inline report load support on dashboard
// now we have a switch to control whether we do it inline
var tForm = GetViewForm("", -1, bGFPReloadInline);
if(sViewID==ksGFPStatePath)
{
var tRoot = XUIGetRootXML("idXUIGFPPreview");
tForm.P1.value = saw.getXmlText(saw.getFirstChildElement(tRoot));
tForm.action = saw.commandToURL("ViewPreview");
submitViewForm(tForm, null);
return;
}
GFPApplyFilters(tForm, tExpr, sViewID);
return false;
}

function GlobalGo(){
try{
var aElm = document.getElementsByTagName('table');
var tTableArray = new Array();
var k = 0;
//Required Field validation variables
var aSpanElm = document.getElementsByTagName('span');
var aReqFields = new Array();
var oneTimeValExists = 'N';
//var oneXXXValExists = 'N';
var sCaption;
var errMsg = '';
var i = 0;
var aDivElm = document.getElementsByTagName('div');
var scopeId;
var scopeIndex;
var sViewId;
//BEGIN ********** DEVELOPER(s): Add Required Fields here
aReqFields[0] = 'Date From';
aReqFields[1] = 'Date To';

//END **********
//Get Captions and Controls to check for required fields/values
for(var a=0; a<aSpanElm.length; a++){
//Get Caption
if(aSpanElm[a].className=='GFPCaption'){
sCaption = aSpanElm[a].firstChild.data;
}
var fromDate ;
var toDate;
//Check if required value exists
if(aSpanElm[a].className=='GFPControl'){
var aInput = aSpanElm[a].getElementsByTagName('input'); // multi-select and text boxes
var aOption = aSpanElm[a].getElementsByTagName('option');  // dropdown
if(sCaption=='Date From'){
if(aInput[0].value != ''){
 fromDate = aInput[0].value;
 fromDate = new Date(fromDate);
 var currdate = new Date();
 currdate = currdate.setDate(currdate.getDate() - 90);
 currdate = new Date(currdate);
 if (fromDate < currdate)
 {
 errMsg = errMsg + '"From date" should not be beyond 90 days from "current date". \n';
 } //end of if condition
}}
if(sCaption=='Date To'){
if(aInput[0].value != ''){
 toDate = aInput[0].value;
 toDate = new Date(toDate);
 var currdate = new Date();
 if (toDate > currdate)
 {
 errMsg = errMsg + '"To date" cannot be greater than "current date". \n';
 }
}}


//Check if a required field
for(var b=0; b<aReqFields.length; b++){
if(sCaption==aReqFields[b]){
var hasValue = 'N';

//Check if multi-select or text box with caption has value
for(var c=0; c<aInput.length; c++){
if(aInput[c].value.length > 0) {
hasValue = 'Y';
}
}

//Check if dropdown with caption has value
for(var c=0; c<aOption.length; c++){
if(aOption[c].selected && aOption[c].value.trim().length > 0){
hasValue = 'Y';
}
}
//if Value does not exists add to errMsg
if(hasValue=='N'){errMsg = errMsg+'* ' + aReqFields[b] +' is a Required Field!\n';}
}
} //EndFor required Fields
//BEGIN ********** DEVELOPER(s): Add Time Fields here
//check if time field
if(sCaption=='Fiscal Period' || sCaption=='Fiscal Week' || sCaption=='Dates'|| sCaption=='Year'){
for(var c=0; c<aInput.length; c++){
if(aInput[c].value.trim().length > 0){
oneTimeValExists = 'Y';
}
}
} //Endif check time field
//END **********
//BEGIN ********** DEVELOPER(s): This is template check for 'OR'ed fields or (At Least one)
//check if time field

No comments:

Post a Comment