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).
Displays the error message at the top of the form.
Parameter(s):
Name | Type |
---|---|
Message | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
s_form.addErrorMessage('Need more information'); |
Adds an informational message to the top of the form
Parameter(s):
Name | Type |
---|---|
message | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
s_form.addInfoMessage('Record successfully created'); |
This method allows to add a choice option to the end of a choice list field.
Parameter(s):
Name | Type |
---|---|
fieldName | String |
choiceValue | String |
choiceLabel | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
s_form.addOption('priority' , 'low' , 'Low'); |
Removes informational messages or error messages in the top of a form.
Return:
Type | Description |
---|---|
Void | This method does not return a value |
This method allows to remove all options from the choice list.
Parameter(s):
Name | Type |
---|---|
fieldName | string |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
s_form.clearOptions('contact_type'); |
This method allows to remove any value from any field.
Parameter(s):
Name | Type |
---|---|
fieldName | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value |
Example:
s_form.getValue('sprint') === null ? s_form.clearValue('points') : false; |
Returns the text value of the field label
Parameter(s):
Name | Type |
---|---|
fieldName | String |
Return:
Type | Description |
---|---|
String | The text of the label. |
Example:
s_form.getLabelOf('assigned_user'); |
This method allows to return the array of the sections.
Return:
Type | Description |
---|---|
Array of HTML elements | The sections. |
This method allows to return the array which will contain the names of all sections, whether visible or not..
Return:
Type | Description |
---|---|
Array of strings | Names of the sections |
Returns the value of the specified field
Parameter(s):
Name | Type |
---|---|
fieldName | String |
Return:
Type | Description |
---|---|
String | The value of the field. |
Example:
s_form.getValue('caller_id'); |
This method allows hiding all related lists on the form.
Return:
Type | Description |
---|---|
Void | This method does not return a value |
This method allows hiding the specified related list on the form.
Parameter(s):
Name | Type |
---|---|
listTableName | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
s_form.hideRelatedList('Note'); |
If the record was never saved then returns true; otherwise returns false.
Return:
Type | Description |
---|---|
Boolean | True | False |
Example:
s_form.isNewRecord() ? alert('New record') : alert('Not new record'); |
Returns true if section is visible; otherwise returns false.
Parameter(s):
Name | Type |
---|---|
sectionName | string |
Return:
Type | Description |
---|---|
Boolean | True | False |
Example:
s_form.isSectionVisible('Notes') ? alert('Visible') : alert('Not visible')' |
Removes the selected option from the list
Parameter(s):
Name | Type |
---|---|
fieldName | String |
choiceValue | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value |
Example:
s_form.removeOption('priority' , 'low'); |
Saves the record without going away (just updating).
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Sets the text value of the field label
Parameter(s):
Name | Type |
---|---|
fieldName | String |
value | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
s_form.getLabelOf('assigned_user', 'Assigned User'); |
This method allows making the specified field mandatory.
Use UI policy instead of this method if possible.
Parameter(s):
Name | Type |
---|---|
fieldName | String |
mandatory | Boolean |
Return:
Type | Description |
---|---|
Void | This method does not return a value |
Example:
s_form.isNewRecord() ? s_form.setMandatory('subject' , true) : s_form.setMandatory('subject' , false); |
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):
Name | Type |
---|---|
fieldName | String |
value | String |
displayValue | String |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Examples:
s_form.setValue('caller_id' , 2 , 'System Administrator'); |
s_form.setValue('priority' , 'low'); |