Set up some statement logic by adding two new helpers to form.js called isAQuestion and filterFieldTypes
Together they filter field types down to question types only, excluding any non-question types such as statements and thankyou screens
Added some new A/B statement logic to the sample.json to say if the answer is A, go to this statement (Awesome!), if the answer is B, go to that statement (Oh no!)
Replaced the required check on the validator.js to dynamically set a HTML attribute of required from the UI layer instead
Renamed the Thankyou component to Statement as an umbrella term for all non-question types that have no input
Implemented logic in the ProgressBar to display the current index of question fields only
Which issue(s) does this PR address?
86
How to test
Run npm install and open up the web survey on localhost:5000
Check that all tests are passing
The user should be able to navigate through the web survey on submission of a valid answer
The user should not be able to navigate through the web survey on submission of an invalid answer
If a field is required and the user submits an empty answer, they should not be able to navigate to the next question
The current question number should display only for fields that are questions i.e. no statements or thankyou screens
What changes have you made?
form.js
calledisAQuestion
andfilterFieldTypes
sample.json
to say if the answer is A, go to this statement (Awesome!), if the answer is B, go to that statement (Oh no!)validator.js
to dynamically set a HTML attribute ofrequired
from the UI layer insteadThankyou
component toStatement
as an umbrella term for all non-question types that have no inputProgressBar
to display the current index of question fields onlyWhich issue(s) does this PR address?
86
How to test
localhost:5000