Content

Groovy Tools

Variables, Objects, and Methods

Code Completion

Diagnostics

Editing

 
Dynamically Created JavaScript

System Actions

   

 

Groovy Tools

Top ../images/arwup.gif (846 bytes)

Variables, Objects, and Methods

 

Variables, objects, and methods exposed for use in Groovy script are described throughout the reference material and examples in the eForms documentation for Form Definitions, Fields, Groups, and Sections.

Code Completion

 

Assistance with Groovy code completion is available throughout the Form Builder. Use Ctrl-Space when the focus in on a Groovy script editor dialog:

Diagnostics

 

Throughout the Form Builder, errors thrown by Groovy expressions indicate the Object (Field, Group, Section, Page) on which the error was thrown, e.g.,

Editing

 

Some editing behaviors:

If a String property accepts only Groovy script (such as the Field property "Value Rule"), the property is not editable in the input field (even though the script is shown). To edit, open the Groovy script editor using the icon next to the input field.
If a String property accepts both Groovy script and text entered into the input field, the property is editable in the input field. You can also edit the Groovy script in the Groovy script editor using the icon next to the input field. Adding a script using the icon and script editor clears the value in the input field. Editing the value in the input field clears the script in the script editor.
If a String property accepts Groovy script, text, and long string, you can edit the input field as well edit the long string by clicking the ellipsis next to the field to. You can also open the Groovy script editor. Adding a Groovy script clears the string and editing the string clears the Groovy script.

 

Dynamically-Created JavaScript

Top ../images/arwup.gif (846 bytes)

These JavaScript functions are not exposed in a *.js file. They are created dynamically in Google Web Tools when a Form is created:

Function Description
getFields() Returns an array of Field Ids.
getCurrentFieldId() Returns the current Field Id.
getCurrentFieldInstance() Returns the current fieldinstance.
getCurrentFieldIndex() Returns the current fieldindex.
gotoField( fieldid, instance ) Goes to the specified Field (including changing the page if necessary, but will not open a non-visible page).
gotoPageNext() Goes to the first Field of the next visible page (does not wrap to page 1 when at page n). Returns the new page number.
gotoPagePrev() Goes to the first Field of the previous visible page (does not wrap to page n when at page 1). Returns the new page number.
getCurrentPage() Returns the current page number.
gotoBookmark( bookmark ) Goes to the specified bookmark (including changing the page if necessary, but will not open a non-visible page).
gotoSection( sectionid ) Goes to the first Field of the specified Section (including changing the page if necessary, but will not open a non-visible page).
gotoSectionNext() Goes to the first Field of the next visible Section (does not wrap to the first Section when on the last Section).
gotoSectionPrev() Goes to the first Field of the previous visible Section (does not wrap to the last Section when on the first Section).
getSectionInstances( sectionid ) Returns the number of Section instances for a specified Section.
getCurrentSectionId() Returns the current Section for the current Field.
getCurrentSectionInstance() Returns the current Section instance for the current Field.
getCurrentSectionIndex() Returns the current Section index for the current Field.
getFieldBinding( fieldid, instance ) Returns an object map with the specified Field's binding properties.
showInstrumentPopup( fieldid, instance ) Displays the Instrument popup for the specified Field (if applicable).
addReplicate( replicates, fieldid, instance ) Adds the specified number of Replicates for the specified bound field (if applicable).
clearValuesCache() Clears the local cache of values.

 

System Actions

Top ../images/arwup.gif (846 bytes)

System Actions available:

AddDocument
CreateWorksheet