How do I restrict a single line text field to 15 characters only?

hemanth16
Tera Contributor

Hi,

I need to restrict the first name and last name fields more than 15 letters 

Can you help me on script?

Thanks in Advance!!

1 ACCEPTED SOLUTION

Can you please try 
g_form.addErrorMessage Instead of showErrorBox.


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

View solution in original post

17 REPLIES 17

Zach Koch
Giga Sage
Giga Sage

Heres is a link to a solution to your problem. It mentions using the variable attribute to limit the characters, such as, max_length=15

Character limit on variable

If this solved your issue, please mark this correct and helpful, thanks!

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!

Hi Zack,

 

Thanks for the response 

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

Can you please help me on this ?

 

Thanks in Advance!!

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