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
Solved! Go to Solution.
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”.
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.
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'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).
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”.
Thank you so much !! this is exactly what i needed. it works perfectly !! thank you soooooo much !!!
Great. I’m going to flesh this out on the Products Blog soon.
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?
const extendedValidation = [
{
name: "FirstName",
values : ["ABC","XYZ"],
message : "Please enter your real name"
}
];
Thank you! Works great!