I want a script to display message based on the choice selected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 08:14 AM
In my field, I want to display field message based on the choice selected. If the choice is changing then the message should also change.
- Labels:
-
Data Acquisition

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 08:27 AM
OnChange client script with either g_form.showFieldMsg('field','message','info') or g_form.addInfoMessage('message'). The first one displays the message under the field and the second one displays the message at the top of the screen. The first step in your script should be the hide the messages so it clears it if a section changes.
g_form.hideFieldMsg('field') or g_form.clearMessages().
Personally I like to use the show and hide field massage as it will appear were the user is looking.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-14-2024 08:28 AM - edited ‎08-14-2024 08:29 AM
Write a onChange() Client script on your field. Example:
Note: replace yourfieldname with the name of your field where you want to show the filed message
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
hideFieldMsg('yourfieldname') //hide field messages if nothing to report
return;
}
g_form.showFieldMsg('yourfieldname','Thanks for changing me','info);
}
Regards
Paul