embed
embed copied to clipboard
Hidden fields missing
I am using the embed SDK to embed a typeform into a page, passing through hidden fields using data-tf-hidden, but they dont get added to the typeform URL, and not present in the hidden fields in the responses of the typeform.
My code:
<div
class="typeform-quiz-container"
data-tf-widget="<?php echo $custom_fields['quiz_typeform_id']; ?>"
data-tf-hidden="user_id=<?php echo get_current_user_id(); ?>"
data-tf-inline-on-mobile
data-tf-on-ready="tfReady"
data-tf-on-submit="tfSubmit"
data-tf-on-question-changed="tfChanged"
data-tf-on-height-changed="tfhChanged"
></div>
The variable and field are getting set in the div as documentation states

When going to the Responses for this typeform, you can see that the fields arnt going through.

I have added the hidden fields as per the documentation:

I am wanting to get the fields back when I pull the results, but it's still returning hidden: {}. I have tried setting multiple hidden fields user_id, name, email, user and more. I have also tried setting the hidden fields in different sequences and combinations. Tried passing through just the user_id, or name, tried combined with multiple fields as well
data-tf-hidden="user_id=<?php echo get_current_user_id(); ?>"
data-tf-hidden="user_id=<?php echo get_current_user_id(); ?>,email=<?php echo get_current_user()->user_email; ?>"
Any ideas?
I tried with your code and I can see the user_id hidden field is passed to the form URL correctly in the DOM:

Can you confirm the hidden field is passed to your iframe as well?
@mathio yes it is being passed into the form URL in the DOM, the iframe src at the end has #user_id=399
Can you please try with a different hidden field name? Maybe user_id name is a reserved name and is clashing with some internal variables? 🤔
I have tried using name, email, user_id, user as well as other ones. When testing now, if I add email, and user at the same time, it shows, but when using user on it's own it isnt showing. When using mutliple fields though and partials come through (only happening now, wasnt happening earlier), user_id isnt coming through at all, most likely reserved somewhere
I will check with respective team if there are any possible name clashes like this.
In the mean time I would suggest renaming problematic hidden fields (user and user_id) to get unblocked immediately.
@joshharington can you please share your form id / URL? Please also share your full JS embed code if you can. And if you have a public website with your typeform it will help too. We will have a look.
Hello @joshharington are you still experiencing this issue?