The SimpleForm API provides methods for customizing forms.

SimpleForm methods can be used on the client side only.

You can also use these methods to configure the contextual dependencies between fields and values (for example, change values in the fields or clear the fields).


s_form.addErrorMessage(message)

Displays the error message at the top of the form.


Parameter(s):

NameType
MessageString


Return:

TypeDescription
VoidThis method does not return a value.


Example:

s_form.addErrorMessage('Need more information');


s_form.addInfoMessage(string message)

Adds an informational message to the top of the form


Parameter(s):

NameType
messageString


Return:

TypeDescription
VoidThis method does not return a value.


Example:

s_form.addInfoMessage('Record successfully created');


s_form.addOption(fieldName, choiceValue, choiceLabel)

This method allows to add a choice option to the end of a choice list field.


Parameter(s):

NameType
fieldNameString
choiceValueString
choiceLabelString


Return:

TypeDescription
VoidThis method does not return a value.


Example:

s_form.addOption('priority' , 'low' , 'Low');


s_form.clearMessages()

Removes informational messages or error messages in the top of a form.


Return:

TypeDescription
VoidThis method does not return a value


s_form.getLabelOf(fieldName)

Returns the text value of the field label


Parameter(s):

NameType
fieldNameString


Return:

TypeDescription
StringThe text of the label.


Example:

s_form.getLabelOf('assigned_user');


s_form.getValue(fieldName)

Returns the value of the specified field


Parameter(s):

NameType
fieldNameString


Return:

TypeDescription
StringThe value of the field.


Example:

s_form.getValue('caller_id');


s_form.isNewRecord()

If the record was never saved then returns true; otherwise returns false.


Return:

TypeDescription
BooleanTrue | False


Example:

s_form.isNewRecord() ? alert('New record') : alert('Not new record');


s_form.isSectionVisible(sectionName)

Returns true if section is visible; otherwise returns false.


Parameter(s):

NameType
sectionNamestring


Return:

TypeDescription
BooleanTrue | False


Example:

s_form.isSectionVisible('Notes') ? alert('Visible') : alert('Not visible')'


s_form.setLabelOf(fieldName, value)

Sets the text value of the field label


Parameter(s):

NameType
fieldNameString
valueString


Return:

TypeDescription
VoidThis method does not return a value.


Example:

s_form.getLabelOf('assigned_user', 'Assigned User');


s_form.setValue(fieldName, value, displayValue)

Sets the field value.

For reference fields or list fields, three arguments are in use: ‘value’ is to set a value name and ‘displayValue’ to display in the field.

For fields of the other types, the argument 'value’ uses to display value in the field and set the value name.


Parameter(s):

NameType
fieldNameString
valueString
displayValueString


Return:

TypeDescription
VoidThis method does not return a value.


Examples:

s_form.setValue('caller_id' , 2 , 'System Administrator');


s_form.setValue('priority' , 'low');