Answer the question
In order to leave comments, you need to log in
How to handle multiple forms with a single route?
You need to validate multiple forms on the page. There can be many forms, from about 2 to 30 on one page.
Right now I'm trying to validate 2 forms that have the same post route.
The 1st form is responsible for the purchase of goods in boxes:
<form method="POST" action="/buyitems">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="items_id" value="4">
<input type="number" class="form-control" value="64" name="count_stack" min="64" max="9999" step="64" style="padding: 5px;">
<li><button type="submit" class="btn btn-default">Купить</button></li>
</form>
<form method="POST" action="/buyitems">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="items_id" value="3">
<input type="number" class="form-control" value="64" name="count_thing" min="64" max="9999" step="64" style="padding: 5px;">
<li><button type="submit" class="btn btn-default">Купить</button></li>
</form>
Answer the question
In order to leave comments, you need to log in
Why are you separating boxes from a separate sale? I recently wrote a warehouse, where I created a supply model for deliveries, Order for shipments and associated these models with all the goods that were sold / received. And it doesn't matter if one product or ten are sold - when creating a new sale, an array of sold products is sent to the server and a new order is created, to which all these products are attached, when editing, an array of products is sent to the /order/{id} route. And the number of goods does not play a role, in any case, an array is sent.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question