Skip to main content
October 11, 2018
Question

Create minimum character limit in name field of form

  • October 11, 2018
  • 1 reply
  • 3871 views

Hello,

I searched around and was unable to find a solution to this issue. I need to set a minimum character limit in the name field of my form. Too many people are filling out the form with single character names (ex: a a), which is creating a duplicate issue in another software we are using. Ideally, I would set the form so that a person has to enter at least two characters into the first and last name field. Any thoughts or solutions out there? Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

SanfordWhiteman
Level 10
October 11, 2018

single character names (ex: a a), which is creating a duplicate issue in another software we are using

Shudder at the design of such software, but anyway... the answer lies in this blog post: More input mask tweaks for Marketo Forms

October 12, 2018

HI Sanford,

I read through the blog post you mentioned but did not see the answer. For both the first name field and the last name field I would like to set a character minimum of two. So in the first name field, no one can put "a" as their first name because it is not enough characters. Therefore the form would not submit until they placed at least two characters in the field.

I apologize if the answer is in the blog post you shared but I read through it three times and couldn't see it.

SanfordWhiteman
Level 10
October 12, 2018

Add these two mask characters:

var maskCharExtensions = {

"L": "[A-Za-z\u00C0-\u024F]",

"l": "[A-Za-z\u00C0-\u024F'. -]?"

};

Then you can use a mask like this in the inputMasks section:

{

  name: "FirstName",

  maskPattern: "LLllllllllllllllllll" // min 2 chars, max 20

}

And of course you need to use the base JS from the post.