The Scripting sample helps you to experience scripting
with the FormCalc and JavaScript languages. You can enter a script
into a box and run it by clicking a button. The sample includes
a variety of field types that the script can use.
The sample includes the file named Scripting.pdf. Both the form
design and the form that the user will interact with are located
in the Forms folder.
To run the Scripting sampleOpen the Scripting.pdf
form, located in \EN\Samples\Forms\Scripting\Forms, in either Acrobat
or Adobe Reader.
Enter a script in the Enter Your Script Here field.
Enter any input that is expected by the script.
Click the appropriate button to run the script. Any output
appears in the Result field. If you prefer, you can assign the results
to another field.
After the script runs, click Clear Fields in order to clear
the fields to rerun or alter the script.
To try a simple
script, use one of these samples.
JavaScriptif (NF1.rawValue < NF2.rawValue)
NF3.rawValue = 0
else
NF3.rawValue = NF1.rawValue - NF2.rawValue
FormCalcif (NF1 < NF2) then
NF3 = 0
else
NF3 = NF1 - NF2
endif
Both scripts use the numerical fields NF1, NF2,
and NF3. The user can type numbers into the NF1 and NF2 fields,
and the script subtracts the numbers (NF1-NF2)
and displays the difference in the NF3 field. If
the result is negative, the NF3 value is set to 0.
|
|
|