In the form I have to define a handler like admin/login
. Then it changes the page when I send it. I also tried using public function indexAction()
handler and only using the controller admin
without a handler, but then nothing happens.
Any help would be greatly appreciated.
Edit:
I wanted to have a error message but it was not so big a site that i wanted to make a form class.
The way i eventually fixed it was the following:
First i use $this->view->pick('admin/index');
in the handler to select my old view.
Next i send a variable like a error message with $this->view->setVars(['username' => $user->name,]);
in the handler.
Last i used it with volt in the previous view views/admin/index.phtml
like this {{ username }}
If you are using a form object you can then use the following code in your volt template
{{ form('myform', 'method':'post', 'role': 'form') }}
This will post your data to the same controller/action that invoked the form. From then you will be able to handle the posted data using valid()
in the form as well as request->isPost()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.