Hi everyone,
I’m trying to create a list that displays products.
In the form there is the name of the product and the quantity.
If I put for example “bread” and “3” for the quantity, once the form is validated, I would like that on my page instead of displaying “3 Bread”, it displays 3 lines with the name “bread”.
To do that, I think the form needs to add 3 “bread” elements in the database instead of only once, but how can I do that automatically without having to have 3 “Name” fields in which I should put “bread”?
basically you need to save first in list state every bread than save it in database when click oke
You only just change input quantity to some button like: Quantity = 0 [ + ] [ - ]
When user click the example [ + ] quantity, addlist state of bread 1 to anything you want
If user add again just plus item in list state
If user press minus just minus item in list state
When user click ok to save in database use list state that created every button quantity pressed
Actually, it was just an example, I really need to see the complete list like this:
Bread
Bread
Bread
Instead of “Bread 3” + -
The real use case is for a sport training app, I’m saving the number of series, repetitions for each exercise. But on a specific page, instead of seeing “3 series of 10 crunchs” I would like to see this:
10 crunchs
10 crunchs
10 crunchs
To save it in the database, I would just have 3 inputs:
Name (in this example it would be crunchs)
NB Series (it would be 3)
NB Repetitions (it would be 10)