0% found this document useful (0 votes)
18 views8 pages

Adobe Training-Day 6

Uploaded by

janilkumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views8 pages

Adobe Training-Day 6

Uploaded by

janilkumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

SAP Adobe Forms for ABAP Developers

Instructor-Led Paid Online Training

WhatsApp: +1-646-727-9273

e-Mail: [email protected]
Day 6 – Form Layout Designing - Scripting

• Java scripts and FormCalc

• Scripts for calculation and display settings

• Complex scenarios

• Practical examples
Use of Scripts in Adobe Forms:

• With Scripts, we can have full control of Form elements at runtime.

• Benefits of scripting:
• Display/Hide Form object based on conditions
• Automatic calculations at Form level
• Dynamically bind data

• Adobe forms support 2 types of scripting:


• FormCalc ( very useful for calculation )
• Java Script

• Live cycle provides a special script editor where we can write the script code.

• Not all objects are supported for writing scripts.

:
Java Script and FormCalc:

• FormCalc – Default scripting language


• It provides built-in functions for various calculation and very easy to use.
• One major drawback : Not working for HTML forms.

• Java Script – Popular language among programmers and designers


• It can be used for both PDF and HTML forms.
• Using JS, we can create custom functions which can be available throughout the Form. This feature is not available in FormCalc.

• FormCalc is more efficient than JS in case of performance.


• However, Due to flexibility provided by JS as compared to Formcalc, JS is being used in most of the scenraios.
How to use scripts in the form?

• Adobe Forms use XFA model i.e. Adobe's XML Form Architecture .

• All the objects on the form can be accessed using method resolveNode .

• We can also access context nodes into script editor and put some validation/binding based on that.

• Method resolveNode can be used to read single record /context structure and resolveNodes can be used to read table.

resolveNode :
❑ When form object has to be accessed from Hierarchy ( within the form layout )
xfa.resolvenode(“data.DPContent.IV_FLAG").rawValue;

❑ When form object has to be accessed from Data ( Global data/Form Context node )
xfa.resolvenode(“$record.IV_FLAG”).value

• Scripts can be written on script editor by selecting the appropriate form object. Selected object can be accessed via “this” operator in script editor.

• We can select the language as Java script or FormCalc from the editor.

• For PDF based forms, scripts should be executed at client side .


Options from Scripts :

• Using scripts, we can set various properties of each form object.

• Data Binding:
❑ Property for binding is rawValue ( for text field/Numeric fields )
❑ this.rawValue should be assigned by some value in script to bind it with the form object.

• Hide/Visible dynamically any control:


• Property for visibility is presence.
• this.presenece should be assigned with one of the following values:
//Options: visible, invisible, hidden, inactive
• Font customization (control/caption)
• this.font.typeface = "Courier";
• this.font.size = "30pt";
• this.font.weight = "bold";
• this.font.posture = "italic";
• this.fontColor = "0,0,0";
• this.fillColor = "153,153,153";

• Calculations:
• FormCalc is preferable for calculation
• It provides built-in functions to be used.
• SUM(DATA[*]).NETWR would calculate sum of all the rows in a table for NETWR
Events in scripts:

• Before writing scripts, we need to select the appropriate event.

• There are multiple events in forms which triggers in a sequence for both – Body page and Master page
Hide Form Objects based on Context Node:

• Select Text Field which we want to put script.


• Go to Script editor, Select INITIALIZE event and language as Java script.
• Below code was written in the tutorial we saw:

However, there was syntactical error which could be rectified by syntax check available in script editor:

Correct syntax should be :


if instead of IF

You might also like