On 14.02.2009, at 00:32, Michal Charemza wrote:

- No errors are shown in the form when there should be. I'm thinking I
should do something in the global_filers.xml file, but I don't know
what.

Yes. Check the sample app for examples. Basically, you have three config parameters:
- error_messages
- field_error_messages
- multi_field_error_messages

Each of those must be an array of items, with each item's key being an XPath expression that is evaluated with the respective form element as the context node, and the value being an array of error message insertion instructions. For error messages that affect multiple fields, FPF will check multi_... for rules first, and then it tries field_error_messages and finally error_messages. Errors that cannot be inserted aren't discarded, but instead kept in a queue for processing. If there are any remaining errors (either because the error doesn't belong to a field in the form, or because it wasn't inserted using any previous rules), error_messages is used again, but with the form itself as the context node for the XPath query. Again, the comments in the sample app's global_filters.xml explain it very well, so have a look at that (http://trac.agavi.org/browser/tags/1.0.0beta9/samples/app/config/global_filters.xml#L15 ).



- If there no errors are in the form, the form seems to submitted
successfully: all the comments, including the new one, are shown below
the form. However, the form is still refilled with the submitted data.
I would like the form to be as it was on original viewing of the page
(just as specified in the template), but maybe with a "Comment
successfull" message.

You really should consider redirecting after the comment was inserted. The Action for adding a comment should do just that, insert the comment, and then perform an external redirect back to the page that shows the blog post (maybe with an anchor link to the comment that was just added).

If you don't want to do that (again, you should; it's a lot cleaner to separate concerns this way), you can prevent the FPF from running by doing

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

in your View.


Cheers,

- 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