Adding custom form validation

Anonymous
Not applicable

Adding custom form validation

I need to make a small JavaScript/jQuery can compare the two input fields. I was led to believe thsi could be done by editing custom form validation. Where can I find this? How do I do this? 
Tags (1)
7 REPLIES 7
Anonymous
Not applicable

Re: Adding custom form validation

Check out the Forms documentation, and in particular example 4 on the page:
http://developers.marketo.com/documentation/websites/forms-2-0/
Anonymous
Not applicable

Re: Adding custom form validation

Thanks Murtza,

I cannot edit the embeded code. The window pops up and shows the Javascript. Howerer, it will not let me edit to. 

How can I now edit the Javascript now that I have found it?
Anonymous
Not applicable

Re: Adding custom form validation

You would have to add your custom JavaScript on the page that checks for when the form loads and then implement changes there. 
Anonymous
Not applicable

Re: Adding custom form validation

Ahh! Im confused 😕

To be clear, I want to trap this invalid email error on the page that I am on (before I go to the follow up page). I want the JavaScript to to call upon this email validation function as the user presses Submit.

I have a feeling it would look like this (see below)....an if/esle statement...but I do not know how to get into the form's code to edit it....

can you offer some advice?



<script type="text/javascript"> 
function checkEmail() { 
   var e1 = document.getElementById('Email').value; 
   var e2 = document.getElementById('confirmEmailAddress').value; 

   if (e1 != e2) { 
      return true; 
   } 
   else 
   { 
     alert('Please verify the email address!'); 
    return false; 
   } 

</script> 
 
 
and set the additional attribute of the submit button to
Code:
onsubmit=" return checkEmail('email1','email2');"

 
Anonymous
Not applicable

Re: Adding custom form validation

Hi Matt

I am using custom validation.
My steps is below.
1.Select "Embed Code"
0EM50000000Snv4.jpg

2. Copy Embed Code
0EM50000000SnvE.jpg

3. Past code at Landing Page HTML Element and Edit it.
0EM50000000SnvJ.jpg

Finish!

Takehiro
Anonymous
Not applicable

Re: Adding custom form validation

Thank you Takehiro

So what you are saying is that this change needs to be made on the landing page, not the form itself? 

I ask because the LP will not be a Marketo landing page and I will need to give this job to someone else. 
Anonymous
Not applicable

Re: Adding custom form validation

Unfortunately, we can not edit embed code in Forms2.0 directly.
It is read only.
But embed code run on other CMS.
Someone can edit embed code on your company's CMS also.