Class: GadgetForm

documents.sdk.gadget GadgetForm

Constructors

The gadget client object for gadget forms.
Provides gadget form related functions for the client side scripting

  • Since:
    • 5.0d

Methods

createFormValidatorResult(result, errorMessage, options){validationResult}

Creates a ValidationResult object to be returned by a custom
form validator

Name Type Description
result boolean

if the validation has failed or succeeded

errorMessage errorMessage optional

displayed if the validation failed

options object optional

option object to add additional information

Returns:
Type Description
validationResult object containing result of the validation

getFormData(){Object}

Returns the current data for every element of the form

Returns:
Type Description
Object form data
Example
//the form object in this example has 3 textFields with the following names: nameField, firstNameField, phoneNumberField
form.onGadgetLoad(function (){
	var formData = documentsContext.getGadgetContext().getClientObject().getFormData();
	//formData -> {nameField: ["Musterman"], firstNameField: ["Max"], phoneNumberField: ["0123456789"]}
});

validateForm()

Validate form based on default and custom set validators

Returns:
true if the form is valid and false if the form is invalid