Skip to content

Commit 45cbfe1

Browse files
committed
changed function from showFieldMsg to addInfoMessage
1 parent 724744d commit 45cbfe1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Client-Side Components/Client Scripts/field word counter/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var maxWords = 100;
5959
- **Over limit**: Error message (red) - "Limit exceeded"
6060

6161
## Notes
62-
- Uses standard ServiceNow APIs: `g_form.showFieldMsg()` and `g_form.hideFieldMsg()`
62+
- Uses standard ServiceNow APIs: `g_form.addInfoMessage()` and `g_form.hideFieldMsg()`
6363
- Create separate Client Scripts for multiple fields
6464
- Works with all text fields and text areas
6565
- Word count excludes extra whitespace and empty strings

Client-Side Components/Client Scripts/field word counter/script.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ function onChange(control, oldValue, newValue, isLoading) {
1313

1414
// Show appropriate message based on word count
1515
if (currentWords > maxWords) {
16-
g_form.showFieldMsg(fieldName, currentWords + ' out of ' + maxWords + ' words - Limit exceeded', ' error');
16+
g_form.addErrorMessage(fieldName, currentWords + ' out of ' + maxWords + ' words - Limit exceeded', ' error');
1717
} else if (currentWords >= maxWords - 5) {
18-
g_form.showFieldMsg(fieldName, currentWords + ' out of ' + maxWords + ' words - Approaching limit', ' warning');
18+
g_form.addInfoMessage(fieldName, currentWords + ' out of ' + maxWords + ' words - Approaching limit', ' warning');
1919
} else {
20-
g_form.showFieldMsg(fieldName, currentWords + ' out of ' + maxWords + ' words', ' info');
20+
g_form.addInfoMessage(fieldName, currentWords + ' out of ' + maxWords + ' words', ' info');
2121
}
2222
}

0 commit comments

Comments
 (0)