To create an HTML Parameter Form field with input or select events:
In the Object Navigator, double click next to the Paper
Parameter Form node to display the Paper Parameter Form view.
Double-click the field object to display the Property Inspector.
Under the Web Settings node, set the Additional Attributes (HTML) property to a valid JavaScript event handler. Note: In some cases (for example, when raising messages), it may be necessary to type JavaScript code in the Before Form trigger.
To insert the JavaScript code in the Before Form trigger:
In the Object Navigator, double-click (the properties icon)
next to the report name to display the Property Inspector.
Under Report Escapes, set the Before Form Type property to Text (if you will type the Javascript) or File (if you will import the JavaScript from a file).
Set the Before Form Value property by clicking the ... button to either type JavaScript in the dialog box or select an HTML file with the JavaScript to import.
This example shows how to set Parameter Form fields for input validation when the report is run through the Web. Doing so will raise a message whenever an end user enters invalid data in the Parameter Form field.
In the Paper Parameter Form view, create a Parameter Form field called PF_DEPTNO.
Double-click the field object to display the Property Inspector:
Under Parameter Form Field, set the Source property to DEPTNO.
Under Web Settings, set the
Additional Attributes (HTML) property to the following JavaScript event
handler:
onChange="checkIt(this.form)"
In the Object Navigator, click (the properties icon) next
to your report name to display the Property Inspector:
Under Report Escapes, set the Before Form Type property to Text.
Set the Before Form Value property the following JavaScript code:
<SCRIPT LANGUAGE = "JavaScript">
function isNumber(inputStr){
for (var i = 0; i < inputStr.length; i++) {
var oneChar = inputStr.charAt(i)
if (oneChar < "0" || oneChar > "9") {
alert("Please enter a numeric value.")
return false
}
}
return true
}
function checkIt(form) {
inputStr = form.DEPTNO.value
if (isNumber(inputStr)) {
// statements if true
}
else {
form.numeric.focus()
form.numeric.select()
}
}
</SCRIPT>
At runtime, if the end user enters the department name in the Runtime Parameter Form rather than the department number when running the report through the Web, the following message is raised:
Please enter a numeric value.
This example shows you how to set Parameter Form fields for select validation when the report is run through the Web. Doing so will raise a message whenever an end user selects Printer from the DESTYPE list of values in the Runtime Parameter Form.
In the Paper Parameter Form view, create a Parameter Form field called PF_DESTYPE.
Double-click the field object to display the Property Inspector:
Under Parameter Form Field, set the Source property to DESTYPE.
Under Web Settings, set the Additional Attributes (HTML) property to the following JavaScript event handler
onChange="isPrinter(this.form)"
In the Object Navigator, click (the properties icon) next
to your report name to display the Property Inspector:
Under Report Escapes, set the Before Form Type property to Text.
Set the Before Form Value property the following JavaScript code:
<SCRIPT LANGUAGE = "JavaScript">
function isPrinter(form) {
if( form.DESTYPE.options[form.DESTYPE.selectedIndex].value
== 'Printer')
alert("Please be sure that your print is installed and running.")
return true}
}
</SCRIPT>
At runtime, if the end user selects PRINTER from a list of values in the DESTYPE field, the following message is raised:
Please be sure that your print is installed and running.
About Parameter Form HTML extensions
About Parameter Forms for Web reports
Changing HTML Parameter Form input to uppercase
Copyright © 1984, 2005, Oracle. All rights reserved.