embed icon indicating copy to clipboard operation
embed copied to clipboard

Hidden fields missing

Open joshharington opened this issue 3 years ago • 7 comments

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 Page source

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

I have added the hidden fields as per the documentation: Set Hidden fields

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?

joshharington avatar Oct 06 '22 12:10 joshharington

I tried with your code and I can see the user_id hidden field is passed to the form URL correctly in the DOM:

Screen Shot 2022-10-06 at 15 04 35

Can you confirm the hidden field is passed to your iframe as well?

mathio avatar Oct 06 '22 13:10 mathio

@mathio yes it is being passed into the form URL in the DOM, the iframe src at the end has #user_id=399

joshharington avatar Oct 06 '22 13:10 joshharington

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? 🤔

mathio avatar Oct 06 '22 13:10 mathio

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

joshharington avatar Oct 06 '22 13:10 joshharington

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.

mathio avatar Oct 06 '22 13:10 mathio

@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.

mathio avatar Oct 07 '22 07:10 mathio

Hello @joshharington are you still experiencing this issue?

mathio avatar Oct 18 '22 13:10 mathio