Scenario: There is this online questionaire that will be filled in by various departments in a company. The questions are data driven and are different for each department. But for some of the questions, the way the input is taken is also different; for some departments the same question is asked to be replied to, by selecting values from a drop down, for the others its free text entry; again, for some departments you change the caption against the area for entry. This caption is not part of the question. its also not coming from the database as of now and Id rather not put it all in the database and increase the joins for each select. Out of the twenty odd questions which have such captions, there are just 3 such captions which change.
for eg.
Department A.)
Q.) How would you like to get here? {caption:"Enter your prefered transport method"} [Free Text Box]
Department B.)
Q.) How would you like to get here? {caption:"Select option"} [Drop Down]
What would be the best way to design and code such web based questionairre of the ways below?
- Implement it using if-else conditions for each department and show and hide input controls as per department
- Abstract all common inputs into a parent class and have multiple child classes for each department which contain their own specific behavior for data input
Any other better way?
Thanks for your time. :)