I am currently developing a Content Management System (CMS) using strapi for a client, and I want to provide them with the ability to control the questions included in a questionnaire. Each question will be categorized under different sections in the questionnaire:
-Section 1
---Question
---Question
-Section 2
---Question
---Question
Within strapi, I have created a collection type with two fields: Section (enumeration type) and Question (text type).
One challenge I am facing is that strapi does not allow spaces in the enumerations, so I have had to name my sections as "business_info" instead of "Business Information". To solve this issue, I have implemented a simple mapping function (a method in Vue.js) to display the correct section name:
sectionMapping(section) {
switch(section) {
case 'business_info':
return 'Business Information';
case 'target_market':
return 'Target Market';
default:
return 'Section'
}
However, this approach requires a code update every time a new section is added to the questionnaire, which is not the most efficient solution. I have considered changing the section from an enumeration to a text data type, but this opens up the possibility of typos creating duplicate sections. This is why I prefer the use of enumerations.
Do you have any tips or suggestions on how to improve this process?
Thank You