SOLVED

Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Go to solution
Ridas
Level 1

Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Hi Marketo Community,

 

I am quite new to Marketo, so sorry if I'm asking for something that was already discussed but I tried to find in old discussion and found nothing. 

 

I created a form in Marketo, One field is collecting a predefined "Code". Let's assume the Predefined code is "AB-BC-CDEF", I need to configure the form so if any one is informing a different code, it triggers a message "Wrong code".

 

I was told only possible with JS coding, I m seeking a bit of guidance as ... I don't know where to access the JC and what code to add.

 

Thank you all !!

 

BR

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted


Thank you ! that is the temporary solution found. concern is as the form will be validated whatever code they will fill as far as it matches the pre set format, leads might think their request is confirmed, but it won't if the code is not correct.

You’re going to need JS. But it’s quite simple as shown here:

MktoForms2 :: Require exact values

You’ll see an error message if you enter any First Name other than “XYZ”.

View solution in original post

9 REPLIES 9
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Using OOTB form capabilities, you could mask the field input, and add information and hint text to let the person know the format in which you're expecting them to fill the data. Input masking wouldn't let the user enter data in any other format than you'd have set. If you don't want to mask input and rather want to validate the format of data in an open text field on the client side, and then display a validation error in case their input doesn't match your desired format, you'd need JS. I like the input masking better though.

 

Ridas
Level 1

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Thank you ! that is the temporary solution found. concern is as the form will be validated whatever code they will fill as far as it matches the pre set format, leads might think their request is confirmed, but it won't if the code is not correct.

Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

You'd def. need client side JS to validate and show error message if the value in a field is not a particular designated value (and doesn’t just match with a particular pattern/format).

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted


Thank you ! that is the temporary solution found. concern is as the form will be validated whatever code they will fill as far as it matches the pre set format, leads might think their request is confirmed, but it won't if the code is not correct.

You’re going to need JS. But it’s quite simple as shown here:

MktoForms2 :: Require exact values

You’ll see an error message if you enter any First Name other than “XYZ”.

Ridas
Level 1

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Thank you so much !! this is exactly what i needed. it works perfectly !! thank you soooooo much !!!

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Great. I’m going to flesh this out on the Products Blog soon.

serdel
Level 1

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Can you explain how to add more than one value to your javascript?

const extendedValidation = [
{
name: "FirstName",
values : "XYZ",
message : "Please enter your real name"
}
];

 

How would the code look if I wanted to accept codes XYX and ABC? 

SanfordWhiteman
Level 10 - Community Moderator

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

const extendedValidation = [
{
name: "FirstName",
values : ["ABC","XYZ"],
message : "Please enter your real name"
}
];
serdel
Level 1

Re: Marketo Form > Apply a rule to a text field: whithout a specific value the form can't be submitted

Thank you! Works great!