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!
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
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.
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.
Thanks, Sanford! And by base JS I assume you mean starting with :
(function() {
MktoForms2.$("body").on("mkto_inputmask_polyfilled", function(e) {
var inputMasks = [
Yes, all the JS except that pertaining to fields that aren't on your form.