SOLVED

Looking for solution appending form values onsuccess

Go to solution
John_Rackerby
Level 1

Looking for solution appending form values onsuccess

In one of my embedded Marketo forms, I'm trying to append the values of two fields onsuccess, but the values do not make it into the record in Marketo. The fields are blank when I look at the record after submitting a test. (eventually I will be passing in the results of an API call, but for now just trying to get these static values passed to get it working)

Here is the code:

$( "input[name='newAccountStatus']" ).val( "signupfail" );
$("input[name='newGoPassword']").attr('value',"123456");

When I set a breakpoint, I can see that the values are successfully being appended,

pastedImage_1.png

Any ideas why these values aren't making it in to Marketo?

Thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Looking for solution appending form values onsuccess

onSuccess fires after the form is successfully submitted.  If you're adding values you do it in the onSubmit, which is before the form goes on the wire.

Also, don't use direct DOM methods (nor jQuery methods) to set values. Use the provided Forms 2.0 API setValues()or addHiddenFields() -- there are many edge cases which will fail otherwise.

If by "append" you mean "add to the form data" (i.e. not "append to the URL") then use addHiddenFields. If you mean "set fields that exist on the form already" then setValues.

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Looking for solution appending form values onsuccess

onSuccess fires after the form is successfully submitted.  If you're adding values you do it in the onSubmit, which is before the form goes on the wire.

Also, don't use direct DOM methods (nor jQuery methods) to set values. Use the provided Forms 2.0 API setValues()or addHiddenFields() -- there are many edge cases which will fail otherwise.

If by "append" you mean "add to the form data" (i.e. not "append to the URL") then use addHiddenFields. If you mean "set fields that exist on the form already" then setValues.

View solution in original post

John_Rackerby
Level 1

Re: Looking for solution appending form values onsuccess

Thanks Sanford!