Hello everyone,
I was wondering if anyone has had experience with the following scenario:
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.
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();
["formid","munchkinId"].forEach(function(instanceSpecificField){
delete formAValues[formSpecificField];
});
// later
formB.setValues(formAValues);