Adobe Forms
-
Upload
lucas-nery -
Category
Documents
-
view
218 -
download
7
Transcript of Adobe Forms
![Page 1: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/1.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Forms vs. Applications… and how to make them behaveJohn BrinkmanAdobe Enterprise Forms Architect
![Page 2: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/2.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
History
Several years ago we recognized the pattern where customers were developing forms with too much JavaScript, too much complexity
On analysis we recognized that we needed to take two approaches
1. Product improvements to reduce the need for JavaScript
2. Better user education on form design patterns
http://blogs.adobe.com/formfeed(since October 2008)
![Page 3: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/3.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Outline
1. Forms, Applications and Monsters
2. Steps to Sanity
3. Form Design Review (Library of Congress)
![Page 4: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/4.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
So you’ve decided to use PDF forms…
You want to:
Enforce business rules
Create a really good user experience
Now you need to add script to your forms
![Page 5: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/5.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Will you be creating a monster?
We see users create forms with:
o Tens of thousands of lines of script
o Several megabytes in size
o Slow open time
o Sluggish performance
o Big memory footprint
o High maintenance costs
o Susceptible to changes in new versions of Reader
o These are our "monster forms"
![Page 6: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/6.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Will you be creating a monster?
Nobody sets out to create a monster
They start small and the requirements start to creep
Form complexity grows incrementally
After several revisions of the form you have a large investment in JavaScript
![Page 7: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/7.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The small monster
You wrote a modest amount of code
Not the most elegant code … but it works
![Page 8: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/8.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The small monster
You wrote a modest amount of code
Not the most elegant code … but it works
You have a manageable, small monster
![Page 9: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/9.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The small monster
You wrote a modest amount of code
Not the most elegant code … but it works
You have a manageable, small monster
Your initial form is a great success!
![Page 10: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/10.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The small monster
You wrote a modest amount of code
Not the most elegant code … but it works
You have a manageable, small monster
Your initial form is a great success!
You copy the code and design patterns to 200 new forms in your department
![Page 11: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/11.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The small monster
You wrote a modest amount of code
Not the most elegant code … but it works
You have a manageable, small monster
Your initial form is a great success!
You copy the code and design patterns to 200 new forms in your department
You discover a flaw in your design pattern – affecting all 200 forms…
![Page 12: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/12.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The small monster
You are now trying to tame an army of small monsters
![Page 13: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/13.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Bad habits escalate
Inefficient code is excusable in small forms -- does not factor into overall processing costs
Small inefficiencies in small forms become big inefficiencies in big forms
Design flaws repeated over many small forms become a maintenance nightmare
![Page 14: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/14.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Two Problem Scenarios
The big monster form:
many person-years of development invested
Critical to business processes
Fragile to update, hard to test
Susceptible to changes in Reader
The collection of small monster forms:
Collectively, many person-years invested
Used in many parts of the business
Common code not shared: maintenance is very expensive
Re-testing is a big job
14
![Page 15: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/15.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Where did we go wrong?
It is perfectly valid to develop forms with lots of script
If the script is well-written the form(s) can be:
Performant
Low maintenance
Testable
BUT…
Adopt a new mindset:
You are no longer developing forms
You are developing applications
Are you ready for application development?
![Page 16: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/16.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Application Development Methodology
Do your form developers have programming skills?
Do you have coding standards?
Do you perform code reviews?
Do you have a source control system?
Do you insist on documentation?
Do you aggressively modularize common code patterns?
Are you prepared to take a step backward and re-factor when needed?
Do you have a quality assurance methodology?
Do you have a form deployment methodology?
![Page 17: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/17.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
You’ve been granted custody of a monster
You’ve been asked to add an enhancement or diagnose a problem -- but don’t know the intricacies of the form
How do I tame the monster?
Welcome to my world
![Page 18: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/18.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Outline
1. Forms, Applications and Monsters
2. Steps to Sanity
3. Form Design Review (Library of Congress)
![Page 19: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/19.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert
2. Bring your forms to version 9.1
3. Share code
4. Think Accessibility First
5. Get to know the available tools
6. Common problems, common solutions
![Page 20: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/20.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert:
JavaScript
XML
XFA
![Page 21: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/21.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be a JavaScript Expert
JavaScript has some very powerful constructs that (if used correctly) can greatly improve your code
Can you write a recursive function?
Do you use try/catch?
Do you use arrays and object literals?
Do you understand JavaScript closure?
Do you use regular expressions?
![Page 22: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/22.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be a JavaScript Expert
There are different implementations of JavaScript
Acrobat/Reader uses Mozilla JavaScript (Spidermonkey)
Includes E4X for manipulating XML
Check out this web page: http://code.google.com/p/jslibs/wiki/JavascriptTips
Server products use ExtendScript – highly compatible
![Page 23: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/23.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert:
JavaScript
XML
XFA
![Page 24: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/24.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be an XML Expert
Can you create an XML document in notepad?
Have you ever written an XSL script?
Can you decipher an XML Schema?
Do you know how XLIFF is used?
Do you understand XHTML?
You need to be familiar with the basics of each
![Page 25: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/25.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert:
JavaScript
XML
XFA
![Page 26: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/26.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be an XFA Expert
XFA Schema
XFA Scripting Object Model
SOM expressions
XFA Events
![Page 27: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/27.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
XFA (template) Schema
Publicly documented (in detail)
Visible in XML Source view
![Page 28: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/28.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be an XFA Expert
XFA Schema
XFA Scripting Object Model
SOM expressions
XFA Events
![Page 29: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/29.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
XFA Scripting Object Model
The scripting object model closely mirrors XFA grammar. e.g.:
<field name="city"><border><fill><color value="0,0,0"/>
</fill></border>
</field>
Set field background color:
city.border.fill.color.value = "100,100,100";or (shortcut):
city.fillColor = "100,100,100";
![Page 30: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/30.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Script Properties that do not correspond to schema:
DOM hierarchy:
all, index, classAll, classIndex, className, somExpression, instanceIndex, isContainer, model, parent, parentSubform, nodes
Shortcuts:
borderColor, borderWidth, fillColor, fontColor, formatMessage, mandatory, mandatoryMessage, validationMessage
Dropdown lists:
boundItem, length, selectedIndex
Field values:
isNull, rawValue, formattedValue, editValue
Miscellaneous:
dataNode, errorText, oneOfChild
![Page 31: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/31.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be an XFA Expert
XFA Schema
XFA Scripting Object Model
SOM expressions
XFA Events
![Page 32: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/32.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
SOM Expressions
Used in data binding
Used as the parameter to resolveNode() and resolveNodes()
Used for FormCalc expressions
![Page 33: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/33.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
SOM expressions and JavaScript Object Expressions
Similar, but not the same. E.g.
A.B.rawValue
Is evaluated differently from:
this.resolveNode("A.B").rawValue;
Can return a different result, but usually does not
SOM has extra capabilities that object expressions do not have
33
![Page 34: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/34.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
SOM Expressions
item[-1] // previous item
po.* // all children of po
item.#field[*] // all field children of item
// predicate in FormCalc:
po.item.[subtotal > 100]
// predicate in JavaScript:
po.item.(subtotal.rawValue > 100)
![Page 35: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/35.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Be an XFA Expert
XFA Schema
XFA Scripting Object Model
SOM expressions
XFA Events
![Page 36: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/36.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Use XFA Events Effectively
Filter keystrokes onChange e.g.:
Convert input to input uppercase
Prevent users from formatting telephone numbers(demo)
Use xfa.event.cancelAction inside preSubmit / preSign / prePrint to cancel if conditions aren’t right
Use initialize to change properties that designer doesn’t expose
Use propagating events (details later)
![Page 37: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/37.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Use XFA Events Effectively
Use execEvent() minimally. It is not intended as a method for sharing code
Put shared code in script objects:
Better performance
Better code readability
![Page 38: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/38.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert
2. Bring your forms to version 9.1
3. Share code
4. Think Accessibility First
5. Get to know the available tools
6. Common problems, common solutions
![Page 39: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/39.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Acrobat 9.1
Enhancements in the 9.1 release specifically addressed the issue of excessive code in forms
Full control over validation processing
Propagating events
field.presence = "inactive"
![Page 40: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/40.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Acrobat 9.1 (XFA 3.0)
Historical Reader behavior was to issue one error message per validation failure
Form authors wrote their own validation frameworks – in order to avoid the message boxes
![Page 41: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/41.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Encapsulation
In this context Encapsulation means:
Keep the code that defines field behaviour inside the field
Validations, calculations should be defined in field calculation, validation scripts
Messages that are specific to a field defined within the field
![Page 42: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/42.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Encapsulated validation
Numeric Field: A.B.C.D:
Encapsulation.A1.B.C.D::validate - (JavaScript, client)this.rawValue > 0;
encapsulation.A1.B.C.D::validationState - (JavaScript, client)this.borderColor = this.errorText ? "255,0,0" : "0,0,0";this.assist.toolTip.value = this.errorText;
![Page 43: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/43.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
External validation
Numeric Field: A.B.C.D
Button Field: checkForm
encapsulation.validate::click - (JavaScript, client) var field = A.B.C.D;var bValid = field.isNull || (field.rawValue > 0);if (bValid) {
field.borderColor = "0,0,0";field.assist.toolTip.value = "";
} else {field.borderColor = "255,0,0";field.assist.toolTip.value =
"The value of D must be greater than zero";}
![Page 44: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/44.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Why is encapsulated better?
(demo)
Better (immediate) user validation feedback
No need for a separate action to trigger validation
Form processor will prevent submit if there are validation failures
External validation is replicating functionality found in the XFA processor
External validation requires writing code for mandatory processing –encapsulated version is handled declaratively
Less code, simpler code
![Page 45: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/45.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Why is encapsulated better?
If any subforms are renamed/moved/unwrapped, the field SOM expression changes
Changed SOM expression causes the external validation script to break:
var field = A.B.C.D;
var bValid = field.isNull || (field.rawValue > 0);
if (bValid) {...
In the encapsulated version, there are no references to field or subformnames, only “this” object.
![Page 46: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/46.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Why is encapsulated better?
When field "D" is included in a fragment:
Encapsulated:
Validation logic is automatically included
Not Encapsulated:
External validation logic not automatically included in the fragment
External logic needs to be knit into the validation logic of the host form
![Page 47: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/47.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Acrobat 9.1 (XFA 3.0)Propagating events
When the same event logic appears on many fields, we can define the event once and propagate
Use cases:
Field highlighting on enter or mouseEnter
Change field appearance on validationState
Change row color on indexChange
![Page 48: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/48.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Designing Propagating events
ES2 designer does not allow you to define propagating field events on a subform
A10 designer removes the propagating UI
To use them you need to edit XML source – or use a macro
demo: uniqueValues.pdf
![Page 49: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/49.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Inactive presence
object.presence = "visible | invisible | hidden | inactive";
visible: object is rendered; events fire
invisible: object is not rendered; participates in layout; events fire
hidden: object is not rendered; excluded from layout; events fire
inactive: objects is not rendered; excluded from layout; events do not fire
(demo)
49
![Page 50: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/50.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Payment sample
Payment Type validation script:
if (this.rawValue === "Credit Card") {
CreditCardDetails.presence = "visible";
} else {
CreditCardDetails.presence = "inactive";
}
// this isn't really a validation –// just a place to trigger on changes to this field
true;
50
![Page 51: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/51.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
How to bring a form to 9.1
![Page 52: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/52.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Remove the compatibility PI
Bug fixes can change the behaviour of forms
We use a processing instruction to ensure compatibility between Reader releases
Compatibility PI ensures you continue to get the same set of behaviours(and same set of bugs) in new releases
To get the latest, from XML Source view, remove:
<?originalXFAVersion http://www.xfa.org/schema/xfa-template/2.5/?>
![Page 53: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/53.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
What if you can’t move to 9.1 yet?
It is possible to build a framework that uses encapsulation and avoids the message boxes
Samples on the formfeed blog
![Page 54: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/54.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert
2. Bring your forms to version 9.1
3. Share code
4. Think Accessibility First
5. Get to know the available tools
6. Common problems, common solutions
![Page 55: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/55.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Share Code
Code sharing is one of the disciplines of good programming
Benefits of code sharing:
Less code
Faster development
Lower maintenance costs
Consistent behaviours within a form and between forms
Simplify complex operations for use by novice form designers
55
![Page 56: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/56.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Share Code
BUT … to get the benefits of code sharing you need to make an investment:
Recognize repeated patterns
Generalize the repeated operation
Isolate the variable parts of the operation into parameters
The generalized version of functionality has higher up-front development costs
Once the initial investment has been made in shared code, the ROI will more than compensate
56
![Page 57: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/57.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Share Code
Code Sharing Mechanisms:
Functions within a script event
Functions within a script object
Script objects stored as fragments
Propagating events
57
![Page 58: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/58.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Shared Code Sample
Task: Copy all field data from one subform to another.
Brute force code looks like:
S2.F1.rawValue = S1.F1.rawValue;
S2.F2.rawValue = S1.F2.rawValue;
S2.F3.rawValue = S1.F3.rawValue;
S2.F4.rawValue = S1.F4.rawValue;
S2.F5.rawValue = S1.F5.rawValue;
(demo)
58
![Page 59: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/59.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Shared Code Sample
Before:
S2.F1.rawValue = S1.F1.rawValue;
S2.F2.rawValue = S1.F2.rawValue;
S2.F3.rawValue = S1.F3.rawValue;
S2.F4.rawValue = S1.F4.rawValue;
S2.F5.rawValue = S1.F5.rawValue;
After:
utilities.subformCopy(S2, S1);
59
![Page 60: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/60.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Create a fragment from a script object
60
![Page 61: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/61.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert
2. Bring your forms to version 9.1
3. Share code
4. Think Accessibility First
5. Get to know the available tools
6. Common problems, common solutions
![Page 62: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/62.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Think Accessibility First
Even if Accessibility is not currently a requirement, make sure you know what an accessible form looks like
The up-front development costs for Accessible forms are much lower than retrofitting accessibility
![Page 63: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/63.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Think Accessibility First
Some design patterns are not accessibility-friendly
Most importantly:
Use captions. Do not use separate text objects
Make sure your tables have rows designated as a header
Carefully define tab order
Don’t rely on color to convey invalid fields
Correcting these after the fact is expensive
![Page 64: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/64.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert
2. Bring your forms to version 9.1
3. Share code
4. Think Accessibility First
5. Get to know the available tools
6. Common problems, common solutions
![Page 65: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/65.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Get to know the available tools
Use the JavaScript console
Form Summary Tool
Dump the data DOM
XFA Debugger
JSLint
Accessibility Checker
XLIFF translator
Develop your own Designer Macros
![Page 66: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/66.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Use the JavaScript console
JavaScript errors show up in the console
At the end of a form session, make sure there are no errors in the console
Use console.println() to trace code
Better yet, leave conditional trace statements in your code permanently
![Page 67: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/67.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Get to know the available tools
Use the JavaScript console
Form Summary Tool
Dump the data DOM
XFA Debugger
JSLint
Accessibility Checker
Develop your own Designer Macros
![Page 68: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/68.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Form Summary Tool
Effective way to get an overview of form content
Understanding the details of a form report can help identify problems
(demo)
![Page 69: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/69.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Get to know the available tools
Use the JavaScript console
Form Summary Tool
Dump the data DOM
XFA Debugger
JSLint
Accessibility Checker
Develop your own Designer Macros
![Page 70: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/70.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Dump the data DOM
Many form design challenges require a good understanding of what the data looks like
Easiest way to understand the data is to dump a snapshot(demo)
![Page 71: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/71.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Get to know the available tools
Use the JavaScript console
Form Summary Tool
Dump the data DOM
XFA Debugger
JSLint
Accessibility Checker
Develop your own Designer Macros
![Page 72: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/72.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
XFA Debugger
For advanced form design it helps to have an understanding of the form processing stages
Opening a form:
1. Create several DOMs
2. Merge data and template
3. Perform calculations and validations
4. Perform layout (pagination)
XFA Debugger gives insight into the final DOMs and resulting layout
![Page 73: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/73.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
XFA Debugger
How it is implemented:
Acroform PDF with a button that loads and opens an XFA-PDF
Once open, uses the XFA scripting object model to extract the state of the form
Passes the state to an embedded flash widget
Flash widget decodes state and displays it graphically
(demo)
![Page 74: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/74.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Get to know the available tools
Use the JavaScript console
Form Summary Tool
Dump the data DOM
XFA Debugger
JSLint
Accessibility Checker
Develop your own Designer Macros
![Page 75: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/75.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
JS Lint
Thank you Douglas Crockford
http://www.jslint.com/
(demo)
![Page 76: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/76.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Accessibility Checker
Accessibility experience is only as good as the effort made by the form author
Accessibility Checker is a Designer Macro that reports on a few basic properties throughout your form
Does not check everything e.g. low contrast colors
(demo)
![Page 77: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/77.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
XLIFF Translator
Set up designer to embed xliff id’s in your form template
XLIFF translator sample is a form whose data schema is the XLIFF schema
Translator sample updates the visible form when translating text
77
![Page 78: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/78.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Create your own Designer macros
The scripting object model is the same as the model used by the runtime
Several samples available to get started
Lots of possibilities
Enforce your own design checks
Apply bulk updates
Generate reports
. . .
![Page 79: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/79.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Steps to sanity
1. Be an expert
2. Bring your forms to version 9.1
3. Share code
4. Think Accessibility First
5. Get to know the available tools
6. Common problems, common solutions
![Page 80: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/80.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Common problems and probable causes
Large PDF size
Slow open time
Sluggish performance
Big memory footprint
Layout issues (blank pages)
![Page 81: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/81.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Large PDF Size
Embedded fonts
Embedded images
Too many objects
![Page 82: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/82.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Embedded fonts
![Page 83: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/83.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
If you need to embed fonts:
Use as few fonts as possible
More control over font embedding on server:
Specify which fonts are embedded and which are not
Specify thresholds for font subsetting
Fonts used by interactive form fields may not be subset
Don’t need to embed fonts installed by Adobe Reader
![Page 84: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/84.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Embedded Images
![Page 85: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/85.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Embedded Image
The image is *always* embedded in the PDF
"Embedded" refers to whether it is embedded in the form design
Whether the image is embedded in the template or not has a big impact on how it is stored in the PDF and how it is processed
![Page 86: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/86.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Linked image
<field name="ImageField1">
<value>
<image href=".\20110209.jpg" contentType="image/jpg"/>
</value>. . .
![Page 87: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/87.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Embedded Image
<field name="ImageField1"><value><image contentType="image/jpg">
/9j/4S5+RXhpZgAASUkqAAgAAAAHAA8BAgAGAAAAYgAAABABAgAOAAAAaAAAABoBBQABAAAAdgAAABsBBQABAAAAfgAAACgBAwABAAAAAgAAADIBAgAUAAAAhgAAAGmHBAABAAAAmgAAAKoCAABDYW5vbgBDYW5vbiBFT1MgNjBEAPAAAAABAAAA8AAAAAEAAAAyMDExOjAyOjA5IDIyOjA2OjIwAB0AmoIFAAEAAAD8AQAAnYIFAAEAAAAEAgAAIogDAAEAAAABAAAAJ4gDAAEAAACQAQAAMIgDAAEAAAACAAAAMogEAAEAAACQAQAAAJAHAAQAAAAwMjMwA5ACABQAAAAMAgAABJACABQAAAAgAgAAAZIKAAEAAAA0AgAAApIFAAEAAAA8AgAABJIKAAEAAABEAgAABZIFAAEAAABMAgAAB5IDAAEAAAAFAAAACZIDAAEAAAAJAAAACpIFAAEAAABUAgAAkZICAAMAAAA1MgAAkpICAAMAAAA1MgAADqIFAAEAAABcAgAAD6IFAAEAAABkAgAAEKIDAAEAAAACAAAAAaQDAAEAAAAAAAAAAqQDAAEAAAABAAAAA6QDAAEAAAAAAAAABqQDAAEAAAAAAAAAMaQCAAsAAABsAgAAMqQFAAQAAAB4AgAANKQCAAYAAACYAgAANaQCAAsAAACeAgAAAAAAAAEAAACgAAAAIwAAAAoAAAAyMDExOjAyOjA5IDIxOjU1OjU3ADIwMTE6MDI6MDkgMjE6NTU6NTcASLlvAEBCDwD/gwUAoIYBAAAAAAABAAAAAwAAAAEAAABpAAAAAQAAAAAaTwCJAwAAALw0AFMCAAAwNTcwMzA5MTI0AABpAAAAAQAAAGkAAAABAAAAAAAAAAAAAAAAAAAAAAAAADEwNW1tADAwMDAwMDAwMDAAAAYAAwEDAAEAAAAGAAAAGgEFAAEAAAD4AgAAGwEFAAEAAAAAAwAAKAEDAAEAAAACAAAAAQIEAAEAAAAIAwAAAgIEAAEAAABuKwAAAAAAAEgAAAABAAAASAAAAAEAAAD/2P/uAA5BZG9iZQBkAAAAAAH/2wCEAAYEBAQFBAYFBQYJBgUGCQsIBgYICwwKCgsKCgwQDAwMDAwMEAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwBBwcHDQwNGBAQGBQODg4UFA4ODg4UEQwMDAwMEREMDAwMDAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDP/AABEIAKsBAAMBEQACEQEDEQH/3QAEACD/xAGiAAAABwEBAQEBAAAAAAAAAAAEBQMCBgEABwgJCgsBAAICAwEBAQEBAAAAAAAAAAEAAgMEBQYHCAkKCxAAAgEDAwIEAgYHAwQCBgJzAQIDEQQABSESMUFRBhNhInGBFDKRoQcVsUIjwVLR4TMWYvAkcoLx
...
![Page 88: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/88.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Embedded Image
Images embedded in the template are stored in base64 format
Causes very large templates: base64 is 4/3 bigger than binary
Forces Designer and Reader to keep the image in DOM memory
Slower open times, higher memory footprint, slower performance in Reader and Designer
Same image used <n> times is stored <n> times
![Page 89: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/89.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Linked Images in PDF
Linked images are stored in a PDF names tree
Linked images are all resolved to a single copy of the image
![Page 90: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/90.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Embedded Image storage in PDF
XDP (Template)
Base64 Image
Base64 Image
![Page 91: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/91.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Linked Image storage in PDF
XDP (Template) Names Tree
<image> Binary Image
<image>
![Page 92: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/92.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Too many objects
Your form may be too large if you have:
Text labels instead of captions
Unnecessary wrapper subforms
Spacing objects
Rectangles instead of borders
Rich text instead of plain text
Duplicated subform instead of repeated subform
![Page 93: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/93.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Slow open time
Forms with certification and encryption take longer to open
(Rights enabling uses encryption)
Large form open time degrades more quickly with decryption
Too many pages!?
Tortured tables – complex row/cell definitions
Fix your binding warnings
![Page 94: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/94.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Sluggish Performance
Form too large
Too much script
Circular script references
Forced re-layout or re-merge
![Page 95: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/95.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Big memory footprint
1. Use strict scoping
2. Use strict scoping
3. Use strict scoping
4. Don’t use Acroforms XMLData object (use E4X instead)
![Page 96: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/96.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Layout issues
Bring your form ahead to 9.1 and re-test
Many layout bug fixes in 9.0 and 9.1
Even if you know you can’t use 9.1, you at least will know if it is a bug or a user error
Use XFA Debugger to check for layout warnings
![Page 97: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/97.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Outline
1. Forms, Applications and Monsters
2. Steps to Sanity
3. Form Design Review (Library of Congress)
![Page 98: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/98.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Form Review
Library of Congress Registration Form
![Page 99: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/99.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Review Step 1
Form Report:
Target: XFA 2.5 (Reader 7.05)
Strict Scoping Off
Bring form version to 9.1
Turn on strict scoping
Start size: 1.66MB
New size after moving to 9.1: 938KB
![Page 100: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/100.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Step 1b) Check for errors
Conversion to strict scoping and moving to a newer version can expose script errors
Test the form and watch the script console
With the LOC form, we needed to fix 3 scripting issues
100
![Page 101: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/101.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Review Step 2
From the report: Fonts are embedded
1 instance of "Times New Roman"
9 instances of "Georgia"
15 instances of "Verdana"
366 instances of "Myriad Pro"
![Page 102: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/102.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Step 2: Reduce Fonts
Change 1 instance of "Times New Roman" to "Myriad Pro" :
New size: 703 KB (From 938KB)
Change 9 instances of "Georgia" to "Myriad Pro" :
New size: 505KB
Change 15 instances of "Verdana" to "Myriad Pro" :
New size: 321KB
(demo)
![Page 103: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/103.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Step 3: Embedded Images
Two embedded images are 136KB and 26KB
Replace with links
New size: 312KB (from 321 KB)
![Page 104: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/104.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Step 4: Country Drop Down Lists
Seven address blocks with a country drop down list
259 countries in each list
1813 total <text> elements for drop down lists (15% of form definition)
Load the lists from a macro on preOpen event:
function load(countryField) {
var countries = ["Afghanistan",… "Zimbabwe"];
countryField.setItems(countries.join(","));
}
New size: 299KB (from 312KB)
![Page 105: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/105.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Check in XFA Debugger
Many objects marked as growable that do not need to be growable
Growable objects are more expensive than fixed size objects for layout
Not a critical problem for this form, but on a large scale could become noticeable
Likely an artefact of early version of Designer
105
![Page 106: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/106.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Review Step 5: Code Review
ACR.details.AI.f2af::initialize - (JavaScript, client)
if(this.rawValue==null)
this.rawValue="";
ACR.details.Cert.FID::initialize - (JavaScript, client)
if(this.rawValue=="" || this.rawValue==null)
this.rawValue=ACR.WBRT.FID.rawValue;
![Page 107: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/107.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Empty fields are always null
ACR.details.AI.f2af::initialize - (JavaScript, client)
if(this.rawValue==null)
this.rawValue="";
ACR.details.Cert.FID::initialize - (JavaScript, client)
if(this.rawValue=="" || this.rawValue==null)
if(this.isNull)this.rawValue=ACR.WBRT.FID.rawValue;
![Page 108: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/108.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
If you want a string…
field.rawValue – data type according to field value
field.formattedValue – always returns string
field.editValue – always returns string
![Page 109: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/109.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Validation on exit
ACRegistration.details.Author_Information.f2gpseu::exit - (JavaScript, client)
if(pseudo_2g.rawValue=="Yes" && this.rawValue==null || pseudo_2g.rawValue=="Yes" && this.rawValue=="")
{xfa.host.messageBox("You must enter a Pseudonym");xfa.host.setFocus(this);
}
(demo 2g)
Exit event is not a good place to perform validations (save/close/reopen sequence will leave the field invalid – but not detected)
Exit validation traps the user in the mandatory field
Validation logic is repeated in global script
Should use presence="inactive" and mandatory setting
![Page 110: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/110.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Alternative:
Design f2gpseu as "required"
ACR.Author.pseudo_2g::change - (JavaScript, client)
if(this.rawValue=="Yes") {f2gpseu.presence = "visible";TextField2.presence = "visible";anon_2g.rawValue = "";
} else {f2gpseu.presence = "invisible inactive";f2gpseu.rawValue = "";TextField2.presence = "invisible";
}
110
![Page 111: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/111.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Validate numeric
ACR.Cert.f8dacc::exit - (JavaScript, client)
formTools.isNumeric(this);
isNumeric() – if not all digits, message box error and resets focus back in the field
Alternative is to prevent alpha input via the change event
![Page 112: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/112.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Code to copy subforms...if(this.rawValue==1) {xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_same_as_rights").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_first").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3af").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_middle").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3am").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_last").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3al").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_org").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3b").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_street").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_street2").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c2").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_city").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_cit").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_st").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_st").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_postal").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_pos").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_coun").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_cou").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_email").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_email").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_phone").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_phone").rawValue;}if(this.rawValue==1){xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_same_as_claimant").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_first").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_first").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_middle").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_middle").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_last").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_last").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_org").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_org").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_street").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_street").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_street2").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_street2").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_city").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_city").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_st").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_st").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_postal").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_postal").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_coun").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_country").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_email").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_emai").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_phone").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_phone").rawValue;}if(this.rawValue==1){xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_same_as_rights").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_same_as_correspondance").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_first").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3af").rawValue; xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_middle").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3am").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_last").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3al").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_org").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3b").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_street").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_street2").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c2").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_city").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_cit").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_sat").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_st").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_postal").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_pos").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_coun").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_cou").rawValue;}if(this.rawValue==1){xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_same_as_claimant").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_same_as_rights").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_first").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_first").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_middle").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_middle").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_last").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_last").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_org").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_org").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_street").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_street").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_street2").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_street2").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_city").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_city").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_sat").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_st").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_postal").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_postal").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_coun").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Correspodence_Contact.f6_coun").rawValue;}if(this.rawValue==1){xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_same_as_claimant").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_same_as_correspondance").rawValue = 0;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_first").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_first").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_middle").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_middle").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_last").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_last").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_org").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_org").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_street").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_street").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_street2").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_street2").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_city").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_city").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_sat").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_st").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_postal").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_postal").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Mail_Certificate_To.f7_coun").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_country").rawValue;}if(this.rawValue==1){xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_first").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3af").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_middle").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3am").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_last").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3al").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_org").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3b").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_street").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_street2").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c2").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_city").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_cit").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_st").rawValue= xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_st").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_postal").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_pos").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_country").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_cou").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_emai").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_email").rawValue;xfa.resolveNode("Application_for_Copyright_Registration.details.Rights_and_Permissions_Contact.f5_phone").rawValue = xfa.resolveNode("Application_for_Copyright_Registration.details.Copyright_Claimain_Information.f3c_phone").rawValue;}
112
![Page 113: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/113.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Code needed when subform copy is shared code…
if (this.rawValue === 1) {f6_same_as_rights.rawValue = 0;util.SF_Copy(Correspodence_Contact, Copyright_Claimain_Information);
}if (this.rawValue === 1) {
Correspodence_Contact.f6_same_as_claimant.rawValue = 0;util.SF_Copy(Correspodence_Contact, Rights_and_Permissions_Contact);
}if (this.rawValue === 1) {
f7_same_as_rights.rawValue = f7_same_as_correspondance.rawValue = 0;util.SF_Copy(Mail_Certificate_To, Copyright_Claimain_Information);
}if (this.rawValue === 1) {
f7_same_as_claimant.rawValue = f7_same_as_rights.rawValue = 0;util.SF_Copy(Mail_Certificate_To. Correspodence_Contact);
}if (this.rawValue === 1) {
f7_same_as_claimant").rawValue = f7_same_as_correspondance").rawValue = 0;util.SF_Copy(Mail_Certificate_To, Rights_and_Permissions_Contact);
}if (this.rawValue === 1) {
util.SF_Copy(util.SF_Copy(Rights_and_Permissions_Contact, Copyright_Claimain_Information);
}
113
![Page 114: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/114.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Seldom (if ever) need to construct a SOM expression
var numberOfTitles = 0;numberOfTitles = ACR.details.WBR.instanceManager.count;for(x=0;x<numberOfTitles;x++) {
var vNodeName = "ACR.details.WBR["+ x +"].f1b";var vTitleValue = xfa.resolveNode(vNodeName).rawValue;. . .
}
114
![Page 115: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/115.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
resolveNode() vs resolveNodes()
Both functions accept a SOM expression argument and search from the context of the node where the call originates
resolveNode() expects to return a single node and returns either a node or null
resolveNodes() expects to return multiple nodes and returns a nodelist
SOM expressions that include either "[*]" notation or a predicate expression will return a list
Calling resolveNode() with an expression that returns a list will cause a runtime error
115
![Page 116: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/116.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Seldom (if ever) need to construct a SOM expression
var numberOfTitles = 0;numberOfTitles = ACR.details.WBR.instanceManager.count;for(x=0;x<numberOfTitles;x++) {
var vNodeName = "ACR.details.WBR["+ x +"].f1b";var vTitleValue = xfa.resolveNode(vNodeName).rawValue;. . .
}
Preferred:
var titles = this.resolveNodes("WBR[*].f1b");for (var i = 0; i < titles.length; i++) {
var vTitleValue = titles.item(i).rawValue;. . .
}
116
![Page 117: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/117.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
prePrint validation
367 lines of script to validate the form contents
if(Work_Being_Registered_Type.f1a.rawValue=="" || Work_Being_Registered_Type.f1a.rawValue==null) {
vRequiredFieldsNotFilledFlag = true;errorMessages+="\r1a. - You must select the Type of Work...";formTools.markFieldRequired(Work_Being_Registered_Type.f1a);
} else {formTools.markFieldNotRequired(Work_Being_Registered_Type.f1a);
}
Many blocks of code similar to this – can be wholly eliminated if using mandatory field processing
117
![Page 118: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/118.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
prePrint validation
Need to push the validations out to the individual fields for encapsulated design
118
![Page 119: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/119.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Too much script
Form currently has over 1200 total lines of script
In 9.1 the same functionality can be implemented in less than half the amount of script – and with a better user experience
119
![Page 120: Adobe Forms](https://reader036.fdocuments.us/reader036/viewer/2022081716/5477ef4db4af9fe6258b459d/html5/thumbnails/120.jpg)
© 2011 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Questions?