Restrict additional comments field to accept only 4000 characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 06:03 AM
Hi Team,
The requirement is to restrict the additional comments(Journal Input - field type) field to accept only 4000 characters on case record. Can anyone please help me how to achieve this requirement. Thanks in advance. I have written onChange client script on case table,
Script: //testing purpose I'm trying to restrict 4 characters only
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var v_comments = g_form.getValue('comments');
var count = v_comments.length;
if (count > 5) {
alert("No.of characters " + count);
g_form.setValue('comments', v_comments.substring(0, 4));
}
}
still it is allowing to enter 5th character but the requirement is to stop allowing the 5th character.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 06:11 AM
Hello @Pandu3
use this script :-
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var v_comments = g_form.getValue('comments');
var count = v_comments.length;
if (count > 5) {
alert("No.of characters " + count);
return false;
}
}
Plz mark my solution as Accept, If you find it helpful.
Regards,
Samaksh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 06:21 AM
return false for an onChange? I am believing you meant onSubmit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 07:56 AM
Hi @Samaksh Wani , no luck!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2023 06:20 AM
Hi,
Script seems fine, what exaclty is the issue?