The way Beauty is incomplete without brain!!!!!!!!
Interactive form is incomplete without scripts.
So let’s discuss the golden part of Interactive adobeforms.
If you are still making V shape with your eyebrow that what I am talking about, let me tell you it’s a Java script/formcalc.
In this article I will be covering how to fill color into input fields, simple mathematical operation, conditional statement and popup windows.
If you don’t know the basic of interactive form and you have not created before kindly go through the how to create an interactive adobeforms.
Before starting the formcalc function the important thing is “how to access the particular element”.
Let’s say you have one input_no input field in your adobeform.
And one submit button. To apply formcalc function on INPUT_NO you can use
Input_no field as ADOBE_DATA.INPUT_NO (see the hierarchy view which gives you a clear idea)
After wrapping it into subform it will be access like
So starting with our first sample:
-
How to fill the input field with a color.
For this you can use a fill color attribute of the input field.
See the blow screen shot (“Don’t worry about extra buttons simply remember that you want to fill the color in the input_no field when you click on the FILL COLOR Button”)
So as I said before to read the input_no field.you need to use
ADOBE_DATA.FORM.INPUT_NO.FillColor = “102,179,255”
Write the above script to Click event of the pushbutton.
So it will fill the input_no field with the color specified.
Now execute Webdynpro application or you can test it using Preview PDF tab.
How to use IF condition and arithmetic operations.
The requirement is to add 100 into input_no field if it contains less than 100 value and subtract 100 from the input_no field if it contains more than 100.
This addition or subtraction should be carried out when you click on the ADD/SUBTRACT Button.
To achieve this :Add a button ADD/SUBTRACT as shown in the below screen shot and add the below formcalc script in onclick event of that button.
if ( ADOBE_DATA.FORM.INPUT_NO.rawValue < 100 ) then
ADOBE_DATA.FORM.INPUT_NO.rawValue = ADOBE_DATA.FORM.INPUT_NO.rawValue + 100
else
ADOBE_DATA.FORM.INPUT_NO.rawValue = ADOBE_DATA.FORM.INPUT_NO.rawValue – 100
endif
How to display the POPUP BOX in the interactive form.
Put one more button in the layout name it as “Popup”.
Click on it and insert the formcalc script as
xfa.host.messageBox( “This is the test for Popupbox”)
Execute your webdynpro application or go to Preview PDF for testing. All the formacalc script