JavaScript is an object-oriented, interpretive language used with HTML to provide dynamic capabilities to otherwise static Web pages.
A JavaScript function included in an HTML page is processed and executed by the Web browser. Integrating a JavaScript function into an HTML page that calls WebFOCUS, or a page that displays a report, enables you to:
For example, suppose you create a page that displays a dynamic report. By including the procedure in a JavaScript function, you can provide text on the page, such as:
Please wait; processing your report request. Do not click Stop.
When a user accesses the page, the procedure runs automatically, and the informative message displays until the report output is returned to the browser.
For an example of the use of JavaScript to automatically run a procedure when an HTML page loads, see the Creating Reporting Applications With Developer Studio manual.
You have many additional design capabilities with JavaScript. See your JavaScript documentation for details on JavaScript techniques and syntax.
Note: For information on where to store the files created in this example, see Defining and Allocating WebFOCUS Files.
The sample launch page uses the Servlet.
Launch Page: VALIDATE.HTM
<HTML> <HEAD> <TITLE> WebFOCUS Report </TITLE>
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
function checkInput() {
if(document.form2.STATE.value == "") {
alert("You must enter a value for the state!");
return false;
}
else {
return true;
}
document.form2.submit();
}
</SCRIPT>
</HEAD>
<BODY>
<H4 ALIGN=CENTER>State Inventory Report</H4>
<HR>
<FORM ACTION="/ibi_apps/WFServlet" METHOD="get"
TARGET="_blank" NAME="form2" onSubmit="return checkInput()">
<INPUT NAME="IBIF_ex" VALUE="stsales" TYPE="hidden">
<P ALIGN=LEFT NOWRAP><PRE>
<B>Enter a state (for example, CA or NY): </B><INPUT NAME="STATE"
TYPE="text" SIZE="2">
</PRE></P>
<P><PRE></PRE></P>
<P>
<INPUT NAME="submit" TYPE=SUBMIT VALUE="Run Report">
<INPUT NAME="reset" TYPE=RESET VALUE="Clear Form">
</P>
</FORM>
</BODY>
</HTML>
Procedure: STSALES.FEX
TABLE FILE CENTORD SUM QTY_IN_STOCK BY STATE BY STORENAME BY PRODNAME WHERE STATE EQ '&STATE' WHERE STORENAME EQ 'eMart' END
WebFOCUS |