JavaScript is an object-oriented, interpretive language used with HTML to provide dynamic capabilities to otherwise static webpages.
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:
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