Answer the question
In order to leave comments, you need to log in
How to collect form data?
Hello.
There is a form with a large number of different fields. Its simplified version https://jsfiddle.net/7f5Ltr2d/ Suppose the user has filled in the first field in each section (.form__section). How can I collect all the entered data along with the headers and display it on the page like this:
Текстовые поля
input 1 - тут значение value
Текстовые области
textarea 5 - тут значение value
Чекбокс
checkbox 3 - тут значение value
Answer the question
In order to leave comments, you need to log in
In data, create an array of objects, each of which will have a label, type, value.
And output them with a v-for loop.
v-model cling to value.
And by type you can display different fields. For example v-if="item.type === 'text'", then output text input.
v-if="item.type === 'select'", then select. And in the same object you can store options.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question