'Adonis.js form submit to controller method not working as it should

I have an Adonis 5 app and this app has a form to submit a listing. I use a controller action method to run on form submit. This action works fine but after it has run I automatically get routed to another page. There are 2 problems with this

  1. I want the controller method to decide where to redirect to depending on the result of the action method

  2. I get routed to a blank page even if I have a page of the same name already populated in my app. It does not show my page but a blank one. I still get routed to a page if it does not exist.

I have used action="/create" and action="{{ route('ListingsController.create') }} and my route is route.post('/create', 'ListingsController.create')

Can anyone explain why and how I can correct this, thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source