Search

Helle everyone,

I'm having trouble getting a simple "save comment" event send the success message back.

I get the errors:

<events>
    <commentaire result="error">
        <message>Entry encountered errors when saving.</message>
        <email label="Email" type="invalid" message="'Email' contains invalid data. Please check the contents." />
        <post-values>
            <nom>dsa</nom>
            <email>sdasd</email>
            <commentaire>asdas</commentaire>
            <article>33</article>
        </post-values>
    </commentaire>
</events>

But upon success the <events /> tag desperatly stays empty... an idea why?

Are you redirecting after success? This will lose the event response. The best thing to start with is changing your form action attribute value to ?debug, so that the form posts directly to the debug view of your page, and will not redirect.

Thanks again for your help!

I was doing a redirect to #comment with <input name="redirect" type="hidden" value="#comment" />

Without the redirect it works fine now. So there is no way of having a redirect and getting the xml response? If I add the redirect (with or without ?debug in action) I lose the response.

forget my last comment.. I just added the redirect in the action attribut. Thanks anyway

The redirect variable that you send will only be used if the event is successful. So you have two options:

  1. Use the redirect to a generic success page, but you cannot use the posted data (unless you then use a data source to re-query the new entry)
  2. Don't use a redirect, post the event to the same page (a blank action attribute) and use XSLT to change the HTML output depending on the result of the event (success/fail).

I usually use #2 above, by hiding the form and replacing it in-page with a thank you message. This way you still have the posted data in the XML so you can have a "Thank you {name}" message.

Thanks for the clarification, I didn't noticed the redirect was only effective upon success since I was redirecting to a hashtag, but when I think about it, it makes perfect sense.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details