Two forms on one website, each with two times {{ csrf_field() }}
Hello,
I have 2 forms on one website, each with two times {{ csrf_field() }}.
If I send a request from the one form and after processing by the controller come back to the blade with new data, everything is ok. If I send a new request from the same form, everything is ok.
However, when I send a request from the other form (after coming back from the one), I get an error 419 | page expired.
If you just have an HTML/blade only form (so no javascript), this should work for multiple forms automatically. The CSRF-token would work just fine for both forms. You can use 100 forms using the same token if you like.
Can you share how you created your form in your view?
Sorry, I forgot how to post a code snippet. The forum completely changed the code I posted above, I don't remember what it was like to put a blade-code in without it being changed.
I only use Javascript to change the attributes of the HTML code, but no AJAX or something like that.
Should be fine with two forms. Either can be submitted. After that form is processed, you should re-render the view by returning a redirect back to the original page.