1 Reply Latest reply on Apr 24, 2018 5:45 PM by Sanford Whiteman

    Form submission based on chosen value

    Danny Tran

      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.

        • Re: Form submission based on chosen value
          Sanford Whiteman

          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
          1 of 1 people found this helpful