How to: Add subtext to a Lookup/Text/Numeric Control
Lookups and text/numeric controls have a unique and useful property called subtext. Subtext is a property that displays a helpful message as text below the field. This text may also be used to add a hyperlink or simply to inform the user of the status of a field, and even provide dynamic information based on value or key values from a lookup.
Step-by-step guide
- To enable this property start by selecting Module, followed by selecting the Module Name.
- Select the Forms tab, followed by the Field List button "Create/Update Fields...".
- Using the filter at the top of the Master field list, search for the relevant Lookup Control.
(Example - "customLookup1" -or- "customString1" -or- "customNumeric1") - After selecting the field from the list, select the Custom JavaScript tab.
- Within the init and/or blur fields paste the JavaScript below to enable the subtext and define a message to be shown.
(Replace the <FieldSystemNameHere> with the Fields actual System Name)
var field = fieldScope.getColumnFromDisplay("<FieldSystemNameHere>");
field.showSubtext = true;
field.subtext = "Your SubText Here";
(Note - This message can include any field value tied to the request, in the format ("Title:" + formScope.formdata.customString1 + "Additional text") - Open the form and verify that the subtext is accurately displayed on the relevant field.
How to Clear Subtext
field.subtext = "";
Related articles