Form submission based on chosen value

Level 3

Form submission based on chosen value

Hello everyone,

I was wondering if anyone has had experience with the following scenario:

  • Have one Marketo landing page
  • Have two forms (Form A and Form B) from two different Marketo instances in the background of the landing page
  • Have Form A submit if value of Country equals specific list of values, or have Form B submit as default

I was using this thread as a reference: Make a Marketo Form Submission in the background for submissions in the background. I know that you can use JS to validate field values, and so I am hoping there is a combination of techniques that I can string together and make a coherent request to our developer.

Thanks in advanced!

Danny T.

Tags (3)
Level 10 - Community Moderator

Re: Form submission based on chosen value

It sounds like you want to have Form A be a visible form, then short-circuit Form A in an onSubmit listener stage and switch to a hidden Form B post instead.

On a purely functional level this is done by setting form.submittable(false) in onSubmit, then running the hidden form submit as outlined in the blog post. Note this will not, on its own, hide Form A. You'll also have to restyle it so it's not visible, to simulate it having been submitted.

You can pass one form's values object to the other easily, as long as you omit the instance-specific values.

var formAValues = formA.getValues();


  delete formAValues[formSpecificField];


// later