-
sarveshshukla075Asked on May 10, 2025 at 10:14 AM
Hi Support,
I need help with dynamically showing and hiding questions on my form based on the account type selected.
Here's the issue:
- I’m adding additional questions to the form dynamically through an API, depending on the account type selected.
- For example:
- If the user selects Account Type 2, then 3 specific questions are added.
- If the user selects Account Type 3, then 5 different questions are added.
- The dynamic loading part works, but there's a problem:
- When I first fill the form and select Type 2, 3 questions appear.
- Then, if I fill the form again and select Type 3, those 5 questions appear along with the previous 3 questions from Type 2.
- So the form keeps adding new questions instead of replacing or resetting the old ones.
What I want to achieve:
- Each time the form is filled and an account type is selected, only the relevant set of questions should be displayed.
- Previously added dynamic questions should be removed or hidden when a new account type is selected.
Can you help me understand:
- Why the old questions keep accumulating?
- How I can ensure that only the correct set of questions is shown each time based on the selected account type?
Thank you!
-
Jovito JotForm SupportReplied on May 10, 2025 at 11:01 AM
Hi Sarvesh,
Thanks for reaching out to Jotform Support. Note that once you add questions to your form using API, it will permanently appear on the form once you browse it. Even if you use API for adding new questions, these actions will permanently appear on the form not unless you delete them.
If you want to show specific questions based on a selected option, you need to add a condition to your form. Jotform's Conditions feature lets you show questions based on the answers that people gave. Let me show you how to set it up:
1. On your My Forms page, hover your mouse over your form and click on Edit Form.
2. In Form Builder, click on the Add Form Element menu and drag-drop the fields you want to use as follow-up questions (I used Short Text fields in this example).
3. Click on the Type a Question text and change it to the question you want to use.
4. Now, right-click on the fields, and in the menu that opens, click on Hide.
Now, let's set up the conditions:
1. In Form Builder, in the orange navigation bar at the top of the page, click on Settings.
2. Click on Conditions on the left of the page.
3. Now, click on Add a New Condition and then click on Show/Hide Field.
4. Set the conditions like you see below:
Set up Conditions for all of the choices for your question. Check out the screencast below to see how your form will work after setting up the Conditions:
Give it a try and let us know how it goes.
Your Answer
Something Went Wrong
An error occurred while generating the AI response. Please try again!