Yeah, you have the right idea of it. By setting
data-prefill-inherit="1" on the embed element, you can inherit from the parent page’s query string. It is the idiomatic way to pull a value into an embedded form.
Alternatively, you can effectively dynamically pre-fill statically. That is, you can use the static pre-filling option
Suppose I have a form with slug example. A plain embed would look like
Imagine that I want to add the URL of the current page to the form somehow, but I don’t want the user to see that I’m doing that.
To do that, I’d want to pre-fill a question of type hidden. I also wouldn’t want to place the URL directly into the query string of the website I’m on because that might look messy.
That means that we’d need to feed that value into
data-prefill on the embed element directly. But, we need to do it dynamically since I might not want to hardcode the URL in every time, and especially not if I want to easily copy and paste this across many of the pages in my website.
It might look something like
const url = location.href;
const form = document.querySelector('[data-paperform-id]');
This is just one example. You can certainly do something different or perhaps even more complicated depending on your use case.
Hope this helps!