If you set the character limit, you won't need an error message, it will not allow them to enter more than 15 characters. Rather than make a script (which I wouldn't recommend since they can't exceed 15 characters, and it will require RegEx), you could add an Annotation (help text) that says that it will not accept more than 15 characters if you think they need to know the character limit.

Here is screenshots of how to set up the annotations 

Here is what it will look like on the form

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

chrisperry
Giga Sage

Hi there,

You can set the max length of these fields from their dictionary settings to be 15:

If this answer is helpful please mark correct and helpful!

Regards,

Christopher Perry

 

If this answer is helpful please mark correct and helpful!

Regards,
Chris Perry

Hi christopherperry,

 

Thanks for the response 

 

It is not string type field it is a variable in catalog item for onboard form 

I need to populate error if they enter more than 15 characters

Can you please help me on this script?

 
Thanks in Advance!!

 

Yousaf
Giga Sage

Hi Hemanth,

Please try,

function onSubmit() {

    if(g_form.getValue('field_name').length > 15){
		g_form.showFieldMsg('Enter less than 15 characters ', 'error', true);
		return false;
	}
}

 

Mark Correct and Helpful if it helps.


***Mark Correct or Helpful if it helps.***

hemanth16
Tera Contributor

Hi Yousaf,

Thanks for the script,

Is it possible to calculate first name field and last name field and show the error if it is more than 15 characters?

Thanks in Advance!!