Your urgent assistance would be so much appreciated, I tried so many things and didn’t get it done :(
I am designing a survey where participants provide updated information about authorized signatories in their business. Here’s how the flow works:
-
First Question:
- The participant is shown a number (let's call it current_number which already comes as am embedded data from the panel) representing the number of authorized signatories we have on record.
- They choose between:
- "Yes, this number is still correct."
- "No, the correct number is different." (If they choose this, they enter a new number in a text box - **with force response**, how do I force response on the text box AND make validation of number only would be great to know.)
- The new value (if provided) should be saved as an embedded data field called actual_number.
-
Second Question (Matrix or Side-by-Side Table - Please advise the type of question, I tried both with no success):
- The participant sees a list of signatories from our records and is asked to indicate whether each is still valid or not (so 2 options, Yes, No)
- If they mark a name as not valid, we count how many are no longer relevant and store this count (sum of No) as an embedded data field called not_relevant.
-
Logic Needed:
- Using JavaScript, I need to calculate how many new signatories the participant needs to provide in the next step.
- Formula: \text{New Rows Needed} = \text{actual_number} - (\text{current_number} - \text{not_relevant})
- This value will determine how many rows appear in the next question using display logic and filters.
Example to Illustrate the Need:
- We have 5 signatories on file (current_number = 5).
- The participant answers:
- "No, this number is incorrect, the correct number is 4." (actual_number = 4)
- In the next question, they mark 2 signatories as still valid, and 3 as not valid.
- not_relevant = 3
- We calculate:
- 4−(5−3)=24 - (5 - 3) = 24−(5−3)=2 → The survey should now ask for 2 new signatories.
Additional Cases:
- If the participant confirms that all 5 are still correct, no new input is needed.
- If they confirm 5 but say 1 name changed, we need to request 1 new name.
Please if you can help me:
Recommend the question type for the second question where they mark relevant or not and guide me how to structure the JavaScript in a way that it listen to the choices when moving to the next question. I can also put a hidden next question that only calculates this if needed (BTW users can come back to the survey and they have back button, so if I need to prevent something let me know…). In general the JS should:
- Save not_relevant as embedded data.
- Perform the calculation for New Rows Needed dynamically.
- Use this value to control the display logic of the next question.
THANK YOU!!! The community here rocks!