Skip to main content

ScriptApi

ScriptApi is an exposed JavaScript API for interaction with Form renderer which serves as an alternative solution for cases that can't be solved with dependencies.

warning
Use with caution! ScripApi requires deep JavaScript knowledge, and scripts are generally harder to develop and maintain than dependencies.

The following section describes ScriptApi functions that can be used in code to customize form interactions:

addListener

The method addListener sets up a function that will be called whenever the specified event is delivered to the form element.

addListener(tagOrPath, eventType, callbackFn, optionsParam)

Parameters:

NameTypeAcceptedRequiredDescription
tagOrPathstring-trueSpecifies the path or tag of form element.
eventTypestringEvent typestrueSpecifies the event type.
callbackFnOnChangeFieldValue--Specifies the callback function used.
optionsParamScriptApiListenerOptions-falseSpecifies the optional parameters for listener.

removeListener

The method removeListener removes set up a function that would be called whenever the specified event is delivered to the form element.

removeListener(tagOrPath, eventType)

Parameters:

NameTypeAcceptedRequiredDescription
tagOrPathstring-trueSpecifies the path or tag of form element.
eventTypestringEvent typestrueSpecifies the event type.

addListenerForVariable

The method addListenerForVariable sets up a function that will be called whenever the specified event is triggered on specific variable.

addListenerForVariable(variableName, eventType, callbackFn)

Parameters:

NameTypeAcceptedRequiredDescription
variableNamestring-trueSpecifies the name of the variable.
eventTypestringEvent typestrueSpecifies the event type.
callbackFnOnChangeFieldValue--Specifies the callback function used.
optionsParamScriptApiListenerOptions-falseSpecifies the optional parameters for listener.

Return type: Array<Observable>

addPreSaveHook

The method addPreSaveHook sets up a callback that will be called every time before form gets saved or updated.

addPreSaveHook(hookName, callbackFn, hookOptions)

Parameters:

NameTypeAcceptedRequiredDescription
hookNamestring-trueSpecifies the name of the callback function.
callbackFnFunction--Specifies the callback function used.
hookOptionsPreSaveHookOptions-falseSpecifies the options when executing the hook.

formatDate

The method formatDate formats the date that is passed in

formatDate(date, format)

Parameters:

NameTypeAcceptedRequiredDescription
dateDate or number-trueSpecifies the date that needs to be formatted.
formatstringEvent typestrueSpecifies the format.

Return type: Array<Observable>

getFieldModel

The method getFieldModel gets the model instance of a form field.

getFieldModel(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: FormElement

validateElement

The method validateElement validates the element and shows errors if there are any.

validateElement(tagOrPath, searchWithinContainerTag, containerMultiIndex, showErrors)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.
showErrorsbooleanfalseSpecifies if the validation should show errors on the specified field.

Return type: boolean

getOrdinalNumberValue

The method getOrdinalNumberValue gets the selected ordinal number of ordinal field.

getOrdinalNumberValue(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: number | undefined

getScaleNumberValue

The method getScaleNumberValue gets the selected scale number of scale field.

getScaleNumberValue(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: number | undefined

getFieldValue

The method getFieldValue gets the value of a form field.

getFieldValue(tagOrPath, multiIndex, searchWithinContainerTag, containerMultiIndex, simpleValue)

Parameters:

NameTypeRequiredDefaultDescription
tagOrPathstringtrue-Specifies the path or tag of form field.
multiIndexnumberfalse0Specifies the index number of the value.
searchWithinContainerTagstringfalse-Specifies the parent container’s tag to search from.
containerMultiIndexnumberfalse0Specifies the parent container’s index to search from.
simpleValuebooleanfalsetrueSimpleValue param was added to preserve backwards compatibility, so that CODED_TEXT still returns label as simple value. in new actions this flag is false and suffixes are used to extract the CODED_TEXT value.

Return type: Object | undefined

getTerminologySelectedValues

The method getTerminologySelectedValues gets the terminology selected values of a form field.

getTerminologySelectedValues(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: Observable

setFieldValue

The method setFieldValue sets the value of a form field.

setFieldValue(tagOrPath, value, prop, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeAccepted valuesRequiredDefaultDescription
tagOrPathstring-true-Specifies the path or tag of form field.
valuestring or number or array<string or number>-true-Specifies the value or values of form field.
propstringProperty namesfalsevalueSpecifies the property name of form field.
multiIndexnumber-false-Specifies the index number of the value.
searchWithinContainerTagstring-false-Specifies the parent container’s tag to search from.
containerMultiIndexnumber-false0Specifies the parent container’s index to search from.

setFieldLabel

The method setFieldLabel sets the label of a form field.

setFieldLabel(tagOrPath, value, language, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeAccepted valuesRequiredDefaultDescription
tagOrPathstring-true-Specifies the path or tag of form field.
valuestring or number-true-Specifies the label of form field.
languagestring-trueenSpecifies the localization.
searchWithinContainerTagstring-false-Specifies the parent container’s tag to search from.
containerMultiIndexnumber-false0Specifies the parent container’s index to search from.

setTerminologyParameter

The method setTerminologyParameter sets the terminology of a form field.

setTerminologyParameter(tagOrPath, paramName, paramValue, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
paramNamestringtrueSpecifies the parameter name of a terminology.
paramValuestringtrueSpecifies the parameter value of a terminology.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setCodedTextFieldByLabel

The method setCodedTextFieldByLabel sets the value of a form coded text field specified by label. If there are multiple items with the same label, it sets the value of the first one.

setCodedTextFieldByLabel(tagOrPath, value, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
valuestringtrueSpecifies the label value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setOrdinalFieldByLabel

The method setOrdinalFieldByLabel sets the value of a form ordinal field specified by label. If there are multiple items with the same label, it sets the value of the first one.

setOrdinalFieldByLabel(tagOrPath, value, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
valuestringtrueSpecifies the label value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setScaleFieldByLabel

The method setScaleFieldByLabel sets the value of a form scale field specified by label. If there are multiple items with the same label, it sets the value of the first one.

setScaleFieldByLabel(tagOrPath, value, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
valuestringtrueSpecifies the label value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setProportionField

The method setProportionField sets the value of a form proportion field.

setProportionField(tagOrPath, numerator, denominator, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDefaultDescription
tagOrPathstringtrue-Specifies the path or tag of form field.
numeratornumbertrue-Specifies the numerator value.
denominatornumbertrue-Specifies the denominator value.
multiIndexnumberfalse0Specifies the index number of the value.
searchWithinContainerTagstringfalse-Specifies the parent container’s tag to search from.
containerMultiIndexnumberfalse0Specifies the parent container’s index to search from.

setDateField

The method setDateField sets the value of a form date field.

setDateField(tagOrPath, year, month, day, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDefaultDescription
tagOrPathstringtrue-Specifies the path or tag of form field.
yearnumbertrue-Specifies the year.
monthnumbertrue-Specifies the month.
daynumbertrue-Specifies the day.
multiIndexnumberfalse0Specifies the index number of the value.
searchWithinContainerTagstringfalse-Specifies the parent container’s tag to search from.
containerMultiIndexnumberfalse0Specifies the parent container’s index to search from.

setDateTimeField

The method setDateTimeField sets the value of a form date time field.

setDateTimeField(tagOrPath, year, month, day, hour, minute, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDefaultDescription
tagOrPathstringtrue-Specifies the path or tag of form field.
yearnumbertrue-Specifies the year.
monthnumbertrue-Specifies the month.
daynumbertrue-Specifies the day.
hournumbertrue-Specifies the hour.
minutenumbertrue-Specifies the minute.
multiIndexnumberfalse0Specifies the index number of the value.
searchWithinContainerTagstringfalse-Specifies the parent container’s tag to search from.
containerMultiIndexnumberfalse0Specifies the parent container’s index to search from.

setTimeField

The method setTimeField sets the value of a form time field.

setTimeField(tagOrPath, hour, minute, multiIndex, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDefaultDescription
tagOrPathstringtrue-Specifies the path or tag of form field.
hournumbertrue-Specifies the hour.
minutenumbertrue-Specifies the minute.
multiIndexnumberfalse0Specifies the index number of the value.
searchWithinContainerTagstringfalse-Specifies the parent container’s tag to search from.
containerMultiIndexnumberfalse0Specifies the parent container’s index to search from.

resetFormElement

The method resetFormElement resets the value of a form element to default.

resetFormElement(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setMaxMultiplicity

The method setMaxMultiplicity sets the max multiplicity value of a form element.

setMaxMultiplicity(tagOrPath, maxMultiplicity, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
maxMultiplicitynumbertrueSpecifies the value of max multiplicity.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setMinMultiplicity

The method setMinMultiplicity sets the min multiplicity value of a form element.

setMinMultiplicity(tagOrPath, minMultiplicity, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
minMultiplicitynumbertrueSpecifies the value of min multiplicity.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setMultiplicity

The method setMultiplicity serves for setting/rendering right amount of elements on form. If you want to have exactly 3 elements you could achieve it by setting min and max both to three, or you simply call api.setMultiplicity('field-id', 3);. This will ensure that you will see exactly three fields rendered no matter if there were more or less than three present before calling setMultiplicity.

setMultiplicity(tagOrPath, multiplicity, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
multiplicitynumbertrueSpecifies the value of min multiplicity.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setAnnotation

The method setAnnotation set annotation on the model

setAnnotation = (tagOrPath, key, value, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
keystringtrueSpecifies the key of annotation
valuestringtrueSpecifies the value of annotation
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

removeAnnotation

The method removeAnnotation removes annotation from the model

removeAnnotation(tagOrPath, key, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
keystringtrueSpecifies the key of annotation
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

getAnnotations

The method getAnnotations gets the model annotation

getAnnotations(tagOrPath, key, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
keystringtrueSpecifies the key of annotation you are getting
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: {aqlPath: string, formId: string, annotations: Object}[]

clearFormElement

The method clearFormElement clears the value of a form element. If the specified element is container, it clears the values of all its children.

clearFormElement(tagOrPath, options, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
optionsScriptApiClearOptions or stringtrueSpecifies the optional parameters for method or the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

hideFormElement

The method hideFormElement hides the form element. If the specified element is a container, it also hides all of its children.

hideFormElement(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

showFormElement

The method showFormElement displays the form element. If the specified element is a container, it also displays all of its children.

showFormElement(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

enableFormElement

The method enableFormElement enables the form element. If the specified element is a container, it also enables all of its children.

enableFormElement(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

disableFormElement

The method disableFormElement disables the form element. If the specified element is a container, it also disables all of its children.

disableFormElement(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

requireFormElement

The method requireFormElement makes the form element required or optional.

requireFormElement(tagOrPath, value, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
valuebooleantrueSpecifies whether the the form element is required or optional.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

getFieldPosition

The method getFieldPosition gets the position of a field in the form.

getFieldPosition(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: number

removeModel

The method removeModel removes the model/field from form

removeModel(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: number

removeValue

The method removeValue removes specific value from DV_ORDINAL, GENERIC_ORDINAL, DV_CODED_TEXT, GENERIC_CODED_TEXT, DV_TEXT (with values) or GENERIC_INPUT_TEXT (with values).

removeValue(tagOrPath, inputItemCode, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form field.
inputItemCodestringtrueSpecifies the code of an input item
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: number

setCodedTextInputs

warning
This function is deprecated and will be removed from API in the future. Please use addFormElementInput instead.

The setCodedTextInputs function is designed to append new input items to a coded text field without affecting the existing ones

setCodedTextInputs(tagOrPath, inputItemValues, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form field.
inputItemValuesarray<InputItem>trueSpecifies the array of input items in the form of {label: string, code: string}[].
searchWithinContainerTagstringfalseSpecifies the parent container's tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

addCodedTextInput

The method addCodedTextInput adds the input to the form coded text field.

addCodedTextInput(tagOrPath, inputItemValue, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form field.
inputItemValueInputItemtrueSpecifies the input item in the form { label: string, code: string }.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

removeCodedTextInput

The method removeCodedTextInput removes the input item of a form coded text field specified by code value.

removeCodedTextInput(tagOrPath, inputItemCode, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form field.
inputItemCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

toggleElement

The method toggleElement toggles between methods hideFormElement and showFormElement for a form element.

toggleElement(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of a form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

getVariable

The method getVariable returns variable name and value.

getVariable(variableName)

Parameters:

NameTypeRequiredDescription
variableNamestringtrueSpecifies the name of the variable.

Return type: Variable

setVariableValue

The method setVariableValue sets the value of a specific variable.

setVariableValue(variableName, value)

Parameters:

NameTypeRequiredDescription
variableNamestringtrueSpecifies the name of the variable.
valueanytrueSpecifies the value of the variable.

clearVariableValue

The method clearVariableValue clears the value of a specific variable.

clearVariableValue(variableName)

Parameters:

NameTypeRequiredDescription
variableNamestringtrueSpecifies the name of the variable.

getComposition

The method getComposition gets composition instance.

warning
Any changes made to the returned composition instance will also bi applied to the saved composition.
getComposition()

Return type: object

updateComposition

The method updateComposition updates the composition on the server.

updateComposition(validate, incomplete)

Parameters:

NameTypeRequiredDefaultDescription
validatebooleanfalsetrueSpecifies if form will be validated before updating.
incompletebooleanfalsefalseSpecifies if composition will be updated as incomplete.

Return type: Promise

saveComposition

The method saveComposition saves the composition on the server.

saveComposition(validate, incomplete)

Parameters:

NameTypeRequiredDefaultDescription
validatebooleanfalsetrueSpecifies if form will be validated before saving.
incompletebooleanfalsefalseSpecifies if composition will be saved as incomplete.

Return type: Promise

destroy

The method destroy destroys all event handlers on the form element.

destroy()

getValueRef

The method getValueRef gets model instance.

warning
Any changes made to the returned model instance will also bi applied to the form element model.
getValueRef(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: FormElement or array<FormElement>

isElementValid

The method isElementValid validates form element and returns validation result.

isElementValid(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: boolean

validateForm

The method validateForm validates the whole form and returns validation result with an errors map inside an object.

validateForm()

Parameters: Function does not accept any arguments

Return type: Object

validatePage

The method validatePage validates page, returns validation result and shows validation errors on page.

validatePage(pageId)

Parameters:

NameTypeRequiredDescription
pageIdstringtrueSpecifies the id of page.

Return type: boolean

isPageValid

The method isPageValid validates page and returns validation result.

isPageValid(pageId)

Parameters:

NameTypeRequiredDescription
pageIdstringtrueSpecifies the id of page.

Return type: boolean

addFormElementInput

The addFormElementInput function enables you to include input items within form components, particularly tailored for type DV_TEXT and DV_CODEDTEXT.

To include input items in DV_TEXT: Provide a plain text string as the inputItem. For DV_CODEDTEXT input items: Supply either an object holding label and code attributes, or an array of such objects.

addFormElementInput(tagOrPath, inputItem, insertIndex, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
inputItemValue{label: string; code: string} or Array of such objects or stringtrueSpecifies the input item or items of form element.
insertIndexnumberfalseSpecifies index in which to insert the input item.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

removeFormElementInput

The method removeFormElementInput removes the input item of a form element specified by code value.

removeFormElementInput(tagOrPath, inputItemCode, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
inputItemCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setCodedTextInputItems

The setCodedTextInputItems method serves to replace the existing input items within a coded text field with a new set of input items.

setCodedTextInputItems(tagOrPath, inputItems, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
inputItemsInputItem[]trueSpecifies the input items.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

duplicateModel

The method duplicateModel duplicates the model of a form element.

duplicateModel(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: ModelDuplicate

setFormLanguage

The method setFormLanguage sets the language of form.

setFormLanguage(language)
NameTypeRequiredDescription
languagestringtrueSpecifies the language of form.

getAqlView

The method getAqlView gets aql view.

getAqlView(viewName)
NameTypeRequiredDescription
viewNamestringtrueSpecifies the name of aql view.

Return type: Promise

executeAql

The method executeAql executes provided aql.

  executeAql(aql, params, force);

NameTypeRequiredDescription
aqlstringtrueSpecifies the aql to be executed
paramsMap<string, any>falseSpecifies the map of variables in aql.
forcebooleanfalseSpecifies if cache should be invalidated

Return type: Promise

getFormInfo

The method getFormInfo gets information about form.

getFormInfo()

Return type: FormInfo

setWidgetConfig

The method setWidgetConfig sets the configuration of the widget.

setWidgetConfig(tagOrPath, config)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of widget.
configobjecttrueSpecifies the configuration of widget.

sendActionToWidget

The method sendActionToWidget sends the action to widget.

sendActionToWidget(tagOrPath, action, value, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of the widget.
actionobjecttrueSpecifies the action of the widget.
valueobjecttrueSpecifies the value you would like to send to the widget.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

refreshData

The method refreshData re-fetch data for specific for widget or field with defined datasource.

refreshData(tagOrPath, searchWithinContainerTag)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of widget.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.

enableValue

The method enableValue enables the input item of form element specified by code value.

enableValue(tagOrPath, valueCode, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
valueCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

disableValue

The method disableValue disables the input item of form element specified by code value.

disableValue(tagOrPath, valueCode, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
valueCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

showValue

The method showValue shows the input item.

showValue(tagOrPath, valueCode, searchWithinContainerTag, containerMultiIndex);
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
valueCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

hideValue

The method hideValue hides the input item.

hideValue(tagOrPath, valueCode, searchWithinContainerTag, containerMultiIndex);
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
valueCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

hideClearValue

The method hideClearValue hides and clears the input item at the same time.

hideClearValue(tagOrPath, valueCode, searchWithinContainerTag, containerMultiIndex);
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
valueCodestringtrueSpecifies the input item code value.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setFeederAudit

The method setFeederAudit sets FeederAudit parameter and its value.

setFeederAudit(param, value, templateId)
NameTypeRequiredDescription
paramstringtrueSpecifies the parameter of FeederAudit.
valuestring or number or object or arraytrueSpecifies the parameter value of the parameter.
templateIdstringfalseSpecifies the template id.

getFeederAudit

The method getFeederAudit gets FeederAudit.

getFeederAudit(templateId)
NameTypeRequiredDescription
templateIdstringfalseSpecifies the template id.

Return type: FeederAudit

callApi

The async method callApi calls a predefined API using the API name and call name and returning a promise.

callApi(apiName, apiCallName)
NameTypeRequiredDescription
apiNamestringtrueSpecifies the name of the API.
apiCallNamestringtrueSpecifies the API Call name.

hideAndClear

The method hideAndClear hides and clears values from a form element or tag.

hideAndClear(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

collapse

The method collapse collapses the container element.

collapse(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

expand

The method expand expands the container element.

expand(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

setFormSubmissionType

The method setFormSubmissionType sets the submission type of form.

setFormSubmissionType(submissionType)
NameTypeRequiredDescription
submissionTypeSubmissionTypetrueSpecifies the submission type (CREATE or UPDATE)

setPatternValidation

The method setPatternValidation sets a specified field with a custom pattern (regex) validation, and error message.

setPatternValidation(tagOrPath, pattern, errorMessages, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
patternstringtrueSets the regex pattern.
errorMessagesstring or Record<string, string>trueSets the error message, if you have multiple languages you set it in the form of {en: 'Error language en', fr: 'Error language fr}
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

removePatternValidation

The method setPatternValidation removes the pattern (regex) validation from a specified field.

removePatternValidation(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

addPostSaveHook

The method addPostSaveHook adds a callback function that executes after saving the composition.

addPostSaveHook(hookName, callbackFn)
NameTypeRequiredDescription
hookNamestringtrueSpecifies the path or tag of form element.
callbackFnfunctiontrueSpecifies the callback function used.

getFieldSearchValue

The method getFieldSearchValue returns the search value in the input of a coded text field.

getFieldSearchValue(tagOrPath, multiIndex, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDefaultDescription
tagOrPathstringtrue-Specifies the path or tag of form field.
multiIndexnumberfalse0Specifies the index number of the value.
searchWithinContainerTagstringfalse-Specifies the parent container’s tag to search from.
containerMultiIndexnumberfalse-Specifies the parent container’s index to search from.

clearValues

The method clearValues clears all the values on the form.

clearValues()

extractDataFromApiResponse

The method extractDataFromApiResponse extracts a value from the API response.

extractDataFromApiResponse(response, keyName)
NameTypeRequiredDescription
responseanytrueSpecifies the API response.
keyNamestringtrueSpecifies the name of the parameter you want to extract

Return type: any

goToNext

The method goToNext goes to the next page of the form. If the document is a summary it will go the next summary page.

goToNext()

goToPrevious

The method goToPrevious goes to the previous page of the form. If the document is a summary it will go the previous summary page.

goToPrevious()

goTo

The method goTo goes to the page specified by the pageId parameter. If the document is a summary it will go the summary page specified by the pageId.

goTo(pageId)
NameTypeRequiredDescription
pageIdstringtrueSpecifies the pageId of either a form or a summary page

clearValue

The method clearValue clears a specific value in the fields which support selection values.

clearValue(tagOrPath, valueCode, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
valueCodestringtrueSpecifies the code of the value you want to clear
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

isEmpty

The method isEmpty returns a boolean value on weather the specified element is empty.

isEmpty(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: boolean

isNotEmpty

The method isNotEmpty returns a boolean value on weather the specified element is not empty.

isNotEmpty(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

Return type: boolean

getSummaries

The method getSummaries returns an array of objects, where each item is composed with a name, id and an array of tags from that summary.

getSummaries()

Return type: array

setImageAreas

The method setImageAreas sets the new areas for the Interactive image , provided as an argument to the function. Areas should be the type of ImageArea or Object that have all the required attributes declared in ImageArea. If provided form id does not belong to field of type DV_CODEDTEXT, function completes without doing anything.

setImageAreas(tagOrPath, areas, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
areasImageArea[] or Object[]trueSpecifies the new areas that should be drawn on the image
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

getImageAreas

The method getImageAreas returns a defined image map areas on for the Interactive image. If more than one model is defined for provided formId, function returns an undefined otherwise it will return an array of ImageArea.

getImageAreas(tagOrPath, searchWithinContainerTag, containerMultiIndex)
NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form field.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

scrollToElement

The method scrollToElement finds the element on the page and scrolls to it. If the element is not found, function completes without doing anything. Optionally, scrollOptions can be specified to control the scrolling behavior.

scrollToElement(tagOrPath, searchWithinContainerTag, containerMultiIndex, scrollOptions)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.
scrollOptionsScrollIntoViewOptionsfalseSpecifies scroll behavior

clearPageValidationErrors

clearPageValidationErrors(pageName)

Parameters:

NameTypeRequiredDescription
pageNamestringtrueSpecifies the path or tag of form element.

clearValidationErrors

The method clearValidationErrors clears validation errors from a form element.

clearValidationErrors(tagOrPath, searchWithinContainerTag, containerMultiIndex)

Parameters:

NameTypeRequiredDescription
tagOrPathstringtrueSpecifies the path or tag of form element.
searchWithinContainerTagstringfalseSpecifies the parent container’s tag to search from.
containerMultiIndexnumberfalseSpecifies the parent container’s index to search from. Defaults to 0 if searchWithinContainerTag is defined.

addTag

The method addTag adds tag to the composition.

addTag(name, value)
NameTypeRequiredDescription
namestringtrueSpecifies the name of the tag.
valuestringtrueSpecifies the value of the tag.