How can i restriction the filed value by using client script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2019 03:09 AM
Hi all,
I have requirement, can I restrict the field value by using client script.
thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2019 11:22 PM
Hi satheesh,
can you please send me the link.
thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-14-2019 11:26 PM
Hi,
You can restrict to 10 chars like below.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue.length>10) {
g_form.showFieldMsg('short_description','....................');
}
}
Mark the comment as a correct answer and helpful once worked.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2019 12:00 AM
Hi asifnoor,
ur code some what's ok , but my requirement is user doesn't enter more 10char.
thanks,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2019 10:44 AM
Hi,
We don't have key event listeners in service is which checks on every key input.
You can only validate the length after the input is given.
So you can write onchange on this field and check the length and if it's greater than 10, then raise an error and reset the field.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if(newValue.length>10) {
g_form.showFieldMsg('short_description','....................');
g_form.clearValue("field name");
}
}
Mark the comment as a correct answer and helpful if it answers your question.