how to return messages from process function on separate form class
Notice: This thread is very old.
- alnux
- Member | 139
hi, i made a separate form class extended from object class
BaseForm.php
PrivilegeForm.php
im trying to return the message, as you know flashmessage method is part of Control class so i cant use this. How can i return the $message to presenter or if you have a suggestion of hoe i can render message on redirect page much better
here my presenter form component
thanks for all
Last edited by alnux (2014-06-30 01:19)
- amik
- Member | 118
There are two basic options:
- when creating your custom form, make it descendant of UI\Form, not a new
class that holds the form as a property. Then, as UI\Form is PresenterComponent,
you can call
$this->getPresenter()->flashMessage()
- Store the message somewhere, then add another onSuccess[] handler in presenter:
By the way, calling isValid() in process() has no point, as onSuccess[] event is raised only when form is valid.