Javascript Tips and Tricks
PLEASE NOTE: Semantic references do not currently work with Webforms. If your current workflow uses Webforms, please continue using the full-form path structure.
Table of Contents
- What are Semantic References?
- What are the benefits?
- How do I implement it?
- Working Example
- Will my current Javascript continue to work?
- Form Packages
What are Semantic References?
With the release of iForm 10.8, we have implemented a new, more efficient way of implementing Javascript using semantic references or what we refer to internally as SPT (Self, Parent, Top).
- self: references the value within the current record.
- parent: references the value within the direct parent record.
- top: reference the value within the top-most record.
What are the benefits?
By using semantic references, there is no need to use the full-form path, which makes copying forms and writing long JavaScript functions more efficient while preventing caching issues.
How do I implement it?
The table below will provide examples of how to implement semantic references in your forms.
Before | After |
my_element_1 | self.my_element_1 |
form.my_element_1 | top.my_element_1 |
form.subform[form.subform.index].my_element_1 | self.my_element_1 |
form.my_element_1 + form.subform[form.subform.index].my_element_2 | parent.my_element_1 + self.my_element_2 |
my_element_1 + form.subform[form.subform.index].subform2[form. subform[form.subform.index] .subform2.index].my_element_2 |
top.my_element_1 + self.my_element_2 |
A Working Example
Will my current Javascript continue to work?
Yes. Any Javascript currently used on your forms will continue to work in the same capacity as it does now.
Form Packages
Comments
0 comments
Please sign in to leave a comment.