Newer Version Available

This content describes an older version of this product. View Latest

SubmitFormData Class

Contains methods to retrieve information on buttons and options selected in a preference form.

Namespace

Example

Use methods in the SubmitFormData class to retrieve the selected values in different form components:

1String buttonClickedId = formData.getButtonClicked();
2if (buttonClickedId == 'submitButton') {
3// Handle form submit
4} else if (buttonClickedId == 'cancelButton') {
5// Handle form cancel
6}
7
8String picklistValueOld = formData.getOldSelectedValue('myPicklist');
9String picklistValueNew = formData.getSelectedValue('myPicklist');
10if (picklistValueOld != picklistValueNew) {
11// Do something
12}
13
14List<String> checkboxValuesOld = formData.getOldSelectedValues('myCheckbox');
15List<String> checkboxValuesNew = formData.getSelectedValues('myCheckbox');
16if (checkboxValuesOld != null && checkboxValuesNew != null && (checkboxValuesOld.size() != checkboxValuesNew.size())) {
17// Do something
18}
19
20String textinputValueOld = formData.getOldStringValue('myTextinput');
21String textinputValueNew = formData.getStringValue('myTextinput');
22if (textinputValueOld != textinputValueNew) {
23// Do something
24}

SubmitFormData Methods

The following are methods for SubmitFormData.

getButtonClicked()

Returns the field ID of the button that was clicked in the preference form. For example, use this method to determine if the clicked button was Submit or Cancel.

Signature

public String getButtonClicked()

Return Value

Type: String

getOldSelectedValue(fieldId)

Returns the value that was set for the specified field when the preference form was previously edited by the user. This method is used for field types such as picklist or radio buttons.

Signature

public String getOldSelectedValue(String fieldId)

Parameters

fieldId
Type: String
Identifies a field in the preference form.

Return Value

Type: String

getOldSelectedValues(fieldId)

Returns a list of the string values that were set on a checkbox field when the preference form was previously edited by the user.

Signature

public List<String> getOldSelectedValues(String fieldId)

Parameters

fieldId
Type: String
Identifies a field in the preference form.

Return Value

Type: List<String>

getOldStringValue(fieldId)

Returns the string value that was set on a field when the Preference form was loaded. This method is used for field types such as text, and throws a TypeException if used with a field that can return more than one value, like a checkbox field.

Signature

public String getOldStringValue(String fieldId)

Parameters

fieldId
Type: String
Identifies a field in the preference form.

Return Value

Type: String

getSelectedValue(fieldId)

Returns the string value that is currently selected for a picklist or radio button field in the preference form.

Signature

public String getSelectedValue(String fieldId)

Parameters

fieldId
Type: String
Identifies a field in the preference form.

Return Value

Type: String

getSelectedValues(fieldId)

Returns a list of string values that are currently selected on a checkbox field in the preference form.

Signature

public List<String> getSelectedValues(String fieldId)

Parameters

fieldId
Type: String
Identifies a field in the preference form.

Return Value

Type: List<String>

getStringValue(fieldId)

Returns the string value that was set on a field when the preference form was loaded. This method is used for field types such as text.

Signature

public String getStringValue(String fieldId)

Parameters

fieldId
Type: String
Identifies a field in the preference form.

Return Value

Type: String