The GET method is not supported for this route. Supported methods: POST.
I am getting this error whenever there is a validation error.
I have a two stage form for property listing. ON the first I input property category and type of property ( both are dropdown and property type is dependent on category ).
The stage 2 form is main form with many fields. I am using the 'required' attribute with most of the fields so submit does not work if there are required errors. But few dropdown are not working properly with required attribute so when I submit I get this error du etc validation in the controller.
The form is working when I fill all the fields and it returns to a different page.
The two stage form is the problem because the second view (probably) is returned from a POST route. Now whenever validation fails and the framework redirects back; it is trying to visit that POST route.
Instead, you should always redirect after a POST request. So, you need to establish a GET route to display the second part of your two stage form.
GET /stage/1 - displays the first part of the form
POST /stage/1 - handles the first part submission, **AND** redirects to...
GET /stage/2 - displays the second part of the form
POST /stage/2 - handles the second part submission
You would need to implement some logic in the GET /stage/2 action to ensure the first part was completed already
@FounderStartup maybe put them in the session or persist to the database in that case; otherwise, you cannot redirect back after submitting the second part because the redirect causes a GET request.