-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
Welcome to the FormTribe
This issue will get you 750 points for the FormTribe Hackathon
Preparation:
If this is your first time contributing, please read:
- Our introductory blog post
- Overview of Code Guidelines at Formbricks.
Only when your PR follows all of the best practices it will get merged.
Want more points quick? Complete Side Quests 🏰
Users want to submit additional (meta-) data along with a link survey without having to set an attribute
Describe the solution you'd like
We allow custom hidden fields in link surveys that can be set via search parameters in the URL.
Feature Description
- A user adds a hidden field to a survey in the survey editor.
In the settings, the user assigns a name to the hidden field (make sure they are unique and don't conflict with current features and forbid names like userId& suid and the questionIds of the current survey. - In link surveys, the content of the hidden field can be set via an URL search param follow this schema: "?hiddenfieldname=hiddenfieldcontent"
- We only support this in link surveys for now. We can add an option for web-app surveys later.
- The content is stored in the response data and displayed in the Summary and Response tabs
Notes
- This is only for link surveys, not for in app surveys
- We already have the whole logic to take data from the URL and add it to the submission in the Link Prefilling feature built by Piyush. Reuse as much of this logic as possible.
- Add the string to the submission via URL parameters
Tasks
- Add a new Card called "Hidden Field" with Hero Icon EyeSlash which is only visible if the
survey type === "linkSurvey"below theThank You Cardin the Survey Editor. In this card, users can add several hidden fields by adding a hidden field Id:
- We built the UI you need already for our tagging system:
While building this, make sure to validate the inputs as follows:
- Do not allow spaces
- Do not allow
userId&suid - Do not allow any of the question Ids of the current survey since they can be used for link prefilling
User can add and remove hidden fields with the UI.
-
Now that the settings are complete, let's make it possible to attach a value to the hidden field Id. To be able to do that, allow people to prefill the hidden fields via URL parameters in the LinkSurvey.tsx. We already have quite some link prefilling logic in the file, it should be pretty straight forward 👍
-
Test extensively with User Identification, Single Use Links, Prefilling of first question