changeHelpText
Changes an existing help text for a specific control at runtime. This function only modifies existing help texts and does not create new ones. Help texts are displayed as additional information for users and provide context or guidance for using the control.
Syntax
app.changeHelpText(controlId, text)
Parameters
Parameter | Type | Description |
---|---|---|
controlId | String | The ID of the control whose help text should be changed |
text | String | The new help text that should be displayed. If empty or null, the existing help text will be cleared |
Return Value
This method doesn't return a value.
Description
The changeHelpText
method allows you to dynamically update the help text associated with a control. Help texts are typically defined during design time, but this method lets you modify them during runtime based on application state or user actions.
Note that this method can only modify existing help texts - it cannot create new help texts for controls that don't already have one defined in the designer.
Examples
Basic Usage
// Change the help text of a control named "customerName"
app.changeHelpText("customerName", "Please enter the full legal name of the customer");
Conditional Help Text
// Change help text based on a condition
if (app.getFieldValue("customerType") === "business") {
app.changeHelpText("taxId", "Enter the company's tax identification number");
} else {
app.changeHelpText("taxId", "Enter the individual's tax identification number");
}
Clearing Help Text
// Remove the help text from a control
app.changeHelpText("notes", "");
Changing Help Text in Response to an Event
app.addEventListener("onChange", "paymentMethod", function(eventArgs) {
if (app.getFieldValue("paymentMethod") === "credit") {
app.changeHelpText("cardNumber", "Enter the 16-digit number without spaces");
} else if (app.getFieldValue("paymentMethod") === "bank") {
app.changeHelpText("cardNumber", "Enter your bank account number");
}
});
Common Use Cases
- Providing context-sensitive help based on user selections
- Updating instructions when application state changes
- Displaying dynamic information in help texts
- Customizing the user experience based on user roles or permissions
Technical Details
The function accesses the help text element by its ID pattern: ht_${formElementId}${controlId}
. If the help text element cannot be found or an error occurs during the operation, the error is logged to the console but will not cause the application to crash.