You are viewing limited content. For full access, please sign in.

Question

Question

Access Token Values via Javascript

asked on October 26, 2016

Hello everyone,

 

I am working on some Javascript functions for Forms. I need to access the Forms token values that were set and assign them to variables in my Javascript function. 

How do I get/acces the token values in Javascript?

Thank you in advance.

0 0

Answer

SELECTED ANSWER
replied on October 26, 2016 Show version history

One potential workaround could be to add "dummy" fields to the form with default values of the variables you need in the custom scripting. (*) Then assign CSS classes to these for referencing purposes, hide the fields with CSS, and you can access the values by referencing the hidden fields. The only caveat would be if, as Xiang mentions in the thread Junaid linked, the value of the variable hasn't yet been processed in the backend, in which case you might obtain null or unexpected data.

If the variables you'd need to reference are related to current date, submission time, etc., I would recommend using built-in Date objects in JavaScript which would probably be less overhead to work with.

Hope this helps!

(*) If the variable you want to access was from a prior submission in the process, to avoid variable bloat you can just add that same variable to the form.

1 0
replied on October 26, 2016

Thank you, I ended up using the hidden fields approach as suggested.

 

Thank you for your help.

0 0

Replies

replied on October 26, 2016

Please take a look at this and let me know if it helps.

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.