How to call a fex procedure in a fex procedure using post method
Table file tab
print
Field1
on table set style *
$
TYPE=DATA,
COLUMN=FIELD1,
FOCEXEC=test_poc_form.fex(P_ROOT=DEPARTMENT_MEMBER)
$
End
I can call this by the above method but with this the URL and its paremeters are visible in the browser
Do any body give me the code how to hide this URL or some thing like POST method
Regards, cd prasadThis message has been edited. Last edited by: Kerry,
May 03, 2007, 03:12 PM
Fernando
quote:
prasad
You can do it by calling a javascript function instead. The javascript function would build a form, fill in the elements and then submit the form.
Fernando
Prod WF 8.1.04, QA WF 8.2.03, Dev WF 8.2.03
May 03, 2007, 03:31 PM
Francis Mariani
Something like this:
-SET &ECHO=ALL;
TABLE FILE CAR
PRINT SALES
BY COUNTRY
BY MODEL
ON TABLE SET ONLINE-FMT HTMTABLE
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, FONT='VERDANA', SIZE=8, $
TYPE=TITLE, STYLE=BOLD, $
TYPE=DATA, COLUMN=COUNTRY, JAVASCRIPT=RunReportDD( COUNTRY ), $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<SCRIPT language='javascript'>
function RunReportDD(vCountry)
{
vReportURL = '/ibi_apps/WFServlet?' + 'IBIF_ex=' + 'DRILL1DD1' + '&|COUNTRY=' + vCountry;
// Construct the Report window's features
vFeatures =
"channelmode=no, directories=no, fullscreen=no, " +
"location=no, menubar=no, resizable=yes, scrollbars=yes, " +
"status=yes, titlebar=no, toolbar=no, "
"left=0, top=0, width=" + screen.availWidth + ", height=" + screen.availHeight;
wRepWindow = window.open(vReportURL, 'wRepWindow', vFeatures);
wRepWindow.focus();
}
</SCRIPT>
-HTMLFORM END
The one problem with this method is that in the drill-down report, the user can right-click and select Properties to see the URL.
You can disable the right-click functionality with something like this:
-SET &ECHO=ALL;
-DEFAULT &TARGET = '';
TABLE FILE CAR
PRINT SALES
BY COUNTRY
BY MODEL
WHERE COUNTRY EQ '&COUNTRY'
HEADING
"DRILL1DD1 / &TARGET"
ON TABLE SET ONLINE-FMT HTMTABLE
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, FONT='VERDANA', SIZE=8, $
TYPE=TITLE, STYLE=BOLD, $
ENDSTYLE
END
-RUN
-HTMLFORM BEGIN
<SCRIPT language=JavaScript>
//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="Function Disabled!";
///////////////////////////////////
function clickIE4()
{
if (event.button==2)
{
alert(message);
return false;
}
}
function clickNS4(e)
{
if (document.layers||document.getElementById&|&|!document.all)
{
if (e.which==2||e.which==3)
{
alert(message);
return false;
}
}
}
if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&|&|!document.getElementById)
{
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false");
</SCRIPT>
-HTMLFORM END
Francis
Give me code, or give me retirement. In FOCUS since 1991
Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
May 03, 2007, 09:19 PM
dhagen
Although Francis' method will work nicely, I think Fernando's suggestion might be alittle cleaner. You can use the JSURL setting to load an existing javascript file into your html report. The JS file can then do the rest without having to create any html.
In the focexec, add the following:
SET JSURL=/approot/baseapp/changeatoform.js
Create a file in the baseapp directory called - oddly enough - changeatoform.js, containing the following:
function changeAllA() {
var anchorList = document.getElementsByTagName("a");
for (var i = 0; i < anchorList.length; i++) {
anchorList[i].href = "JavaScript:submitAasForm(\"" + anchorList[i].href + "\");";
}
}
var submit_form = "submit_form";
function submitAasForm(qs) {
var submit_form = document.getElementById(submit_form);
if(!submit_form) {
submit_form = document.createElement("FORM");
if(submit_form) {
submit_form.name = submit_form;
submit_form.id = submit_form;
document.body.appendChild(submit_form);
}
} else {
var children = submit_form.childNodes;
var len = children.length;
for(var i = len-1; i >= 0; i--) {
submit_form.removeChild(children[i]);
}
}
var qsValues = qs.split('?');
submit_form.action = qsValues[0];
submit_form.method = "post";
var keyPairs = qsValues[1].split("&");
for (i=0; i<keyPairs.length; i++) {
if (keyPairs[i] != "") {
// alert(keyPairs[i]);
var keyValues = keyPairs[i].split("=");
var input = document.createElement("INPUT");
if(input) {
input.type = "hidden";
input.name = keyValues[0];
input.value = keyValues[1];
submit_form.appendChild(input);
}
}
}
submit_form.submit();
}
if (window.addEventListener) {
window.addEventListener('load', 'changeAllA', false);
} else if (window.attachEvent) {
window.attachEvent('onload', changeAllA);
} else {
alert("not supported");
}
When your report runs, this will dynamically change all the href's to javascript calls. The javascript will then create a form and all the parameters as hidden input boxes and submit the form as a post.
Hope this helpsThis message has been edited. Last edited by: dhagen,
"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
April 23, 2010, 01:08 PM
texgator
I tried the JSURL method but that doenst seem to work for me. I am not that familiar with JS so was wondering what to do if I wanted to hide/obscure the URLs for the following multi drill down.
WebFOCUS 7.6.10 Windows all output (Excel, HTML, PDF)
April 23, 2010, 01:30 PM
njsden
FOCEXEC style keyword will always create a fully-formed URL! The only way to "hide" parameters in it is to either embed them inside of an HTML <form> element using method=post --OR-- issuing an Ajax call to handle the whole process.
Regardless of which method you use, Javascript is the language that will allow you to do that.
Both of the approaches provided by Francis and dhagen work but you will need to get more than familiarized with Javascript to fully enhance the functionality of your reporting applications. Regrettably WebFOCUS cannot completely help you there.
I understand this is an old thread but, I have a similar requirement where I COMPUTE a URL to call an external application (http://servername/some.aspx?parms=BlobField) with a BLOB or varcharMAX which will break the browser limit. Any ideas on how to get this function working for URL call? We're using 8202 here Thanks in advance!