project-icp / bee-pollinator-app

The web application front end for the ICP Pollinator Decision Support Tool 🐝
Apache License 2.0
6 stars 1 forks source link

Make Form Fields Conditional #477

Closed rajadain closed 5 years ago

rajadain commented 5 years ago

The schema document asks for some fields to be conditional in the November Survey:

Name Label Values Notes
varroa_check_frequency How often do you check for Varroa? I do not check, once a year, twice a year, three times a year, more than three times a year These are finalized (I modified one option)
varroa_method What method do you use to check for Varroa? Alcohol wash, sugar shake, sticky boards, other (fillable field) Skip if they do not check for Varroa. Multiple selections are allowed here.
varroa_manage_frequency Do you manage for Varroa? If so, how often? I do not manage, once a year, twice a year, three times a year, more than three times a year Skip if they do not check for Varroa

Similarly, there are conditional fields in the UserSurvey:

Name Label Values Notes
varroa_management Do you manage for Varroa? Yes/No  
varroa_management_trigger How do you decide when to manage for Varroa? Text Only if they answer "Yes" to varroa_management
purchased_queens Do you buy queens, nucs or packages? Yes/No  
purchased_queen_sources please provide the state(s) where your purchased bees originated from Text Only if they answer "Yes" to purchased_queens
resistant_queens Do you use Varroa-resistant queens? Yes/No  
resistant_queen_genetics Describe their genetics Text Only if they answer "Yes" to resistant_queens

Conditional fields are implemented in the MonthlySurvey as such:

https://github.com/project-icp/bee-pollinator-app/blob/e24ccff21c9ca9fb8f6a67eda24b2665eebb7242/src/icp/apps/beekeepers/js/src/components/MonthlySurveyColonyForm.jsx#L131-L144

Use a similar technique to implement them in the November and User surveys.