SOLVED

Re: System token in Form 2.0

Go to solution
Anonymous
Not applicable

System token in Form 2.0

Hi,

I'm currently setting up a referral program and need to populate a hidden field with the date the form gets submitted. Is it possible to use system tokens in the forms to do that?
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Re: System token in Form 2.0

Hi Anissa - Don't think about putting the date in the form, but rather create a smart campaign. When Form is Submitted, then change the last submitted date field to {{system.dateTime}}

Make sense?

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Re: System token in Form 2.0

Hi Anissa - Don't think about putting the date in the form, but rather create a smart campaign. When Form is Submitted, then change the last submitted date field to {{system.dateTime}}

Make sense?
Anonymous
Not applicable

Re: System token in Form 2.0

Makes sense 🙂 Thanks, Adam!
Kim_Meyers
Level 4

Re: System token in Form 2.0

Hello.

I'm embedded a forms 2.0 form on my website and {{system.dateTime}} as a hidden field isn't working. In Marketo, instead of showing the date/time stamp, it shows "{{system.dateTime}}". 

Any ideas as to why and how to fix?

Anonymous
Not applicable

Re: System token in Form 2.0

Hmm. No. Don't embed it in a hidden field. Write a smart campaign that says, when this form is submitted, THEN in the flow step, change FIELD NAME to {{system.dateTime}}
Anonymous
Not applicable

Re: System token in Form 2.0

Adam - curious to know why we can't just embed it, seems easier but doesn't work!

SanfordWhiteman
Level 10 - Community Moderator

Re: System token in Form 2.0

Don't know what Adam was getting at, save for the fact that the token won't work on non-Marketo pages.

You can -- and, in my opinion, should -- add the timestamp in the browser. The less your server has to do, the better.

MktoForms2.whenReady(function(form){

    form.onSubmit(function(form){

      form.addHiddenFields({

            "lastFormSubmit" : new Date().toISOString()

        });

  });

});

Of course "lastFormSubmit" should be replaced with the name of the field in your instance.

The only liability -- if you can call it that -- is that a malicious person could forge the submission date, while in the flow it'll always stamp the real date. Why that hack, of all things, would be what bad guy would choose to do escapes me.

Kim_Meyers
Level 4

Re: System token in Form 2.0

Got it. Thanks Adam W!