To limit Short description length to 80 characters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 09:10 AM
Hi,
I have got a requirement wherein the short description field in Incident form should be limited to 80 characters.
User who is typing should be able to type only 80 characters and when he/she types the 81st character, an error message should be displayed and not allow to type more.
Please help me with this. Thanks in advance!!!
Regards,
Gopi
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2020 12:32 AM
Hi use below code and it will solve your question
function onSubmit() {
//Type appropriate comment here, and begin script below
var shDesc = g_form.getValue('short_description');
if(shDesc.length > 100){
alert("Your short description should be 100 characters or less. Please correct.");}
return false;
}
plz mark correct and helpful if it clarify your question
Thanks
Rajender
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2020 12:52 AM
Hi,
Business Rule
Condition: current.getValue("short_description").length > 80
Script:
current.abortAction(true);
gs.addErrorMessage("The short description field can be no more than 80 characters")
Client Script
Type: onChange
Script:
var value= g_form.getValue("short_description");
if (value.length > 80) {
g_form.showFieldMsg("short_description", "The short description field can be no more than 80 characters", "error");
g_form.setValue("short_description", value.substring(0,79));
}
please mark as correct/helpful based on impact.
Thanks
Darshani Sambare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2020 12:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2020 01:03 AM