S
S
Sergey2021-03-24 11:53:35
JavaScript
Sergey, 2021-03-24 11:53:35

How to split one input field into several values?

Hey!

Tell me how you can make it so that when you enter a value in one field, it is divided into several?

Example:
There is one input, we enter the full name there, and we get:

{
 "firstName": "Иван",
  "lastName": "Иванов",
  "middleName": "Иванович",
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kovalsky, 2021-03-24
@justedoit

Split the original string, put the desired values ​​into an object

A
Andrey Okhotnikov, 2021-03-24
@tsepen

It is better, of course, to create a separate input for each value, you never know what the user enters, forgets to enter the patronymic, or swaps the IOF and enters, as a result, incorrect data will enter the database

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question