On 08.07.2009, at 20:19, Veikko Mäkinen wrote:

[email protected] wrote:
Hi all

I have a strange problem. I have a search form which is submitting
data via GET. When submitted with invalid data, the validator error
messages don't appear. However, when i change the method to POST and
the Action's executeRead to executeWrite, the messages show up. Can
someone advise why this is happening and how to correct it?


Error messages are injected by the FormPopulationFilter (commonly known as FPF) but by default FPF is ran only on write requests. So you need to tell FPF to run even if it is a read request. Like this (in the error view):

$this->getContext()->getRequest()
  ->setAttribute('populate', true,
'org.agavi.filter.FormPopulationFilter');

That won't help though. The issue is that the current URL will look something like:
/search?term=bleh&scope=blah
While the <form> has action="/search". The FPF cannot magically detect that form as matching in this case.

So what you need to do is
a) force the FPF to assume another current URL (less convenient) or
b) force the FPF to blindly populate a specific form (identified by id, more convenient):
...->setAttribute('populate', array('formid' => true), ...


You can also change FPF's settings in global_filters.xml but usually you
don't want to run it on every read request.

Precisely.

HTH,

David

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to