Search

I don’t understand why this doesn’t work. It’s my contact form.

Here is the xslt.

<form action="" method="post">
<xsl:for-each select="/data/events/save-message">
  <p class="{@result}">
    <xsl:choose>
      <xsl:when test="@result = 'success'">Email sent.</xsl:when>
      <xsl:otherwise>The system encountered errors while sending your email. Please check if all the required fields have been filled.</xsl:otherwise>
    </xsl:choose>
   </p>
  </xsl:for-each>
  <fieldset>
  <label class="required">Name <input type="text" name="fields[name]" value="{events/save-message/post-values/name}" /></label>
  <label class="required">Email <input type="text" name="fields[email]" value="{events/save-message/post-values/email}" /></label>
  <label>Message<textarea name="fields[message]" rows="5" cols="21"><xsl:value-of select="events/save-message/post-values/message" /></textarea></label>

  <input name="send-email[recipient]" value="{website-owner/author/username}" type="hidden" />
  <input name="send-email[sender-email]" value="fields[email]" type="hidden" />
  <input name="send-email[sender-name]" value="fields[name]" type="hidden" />
  <input name="send-email[subject]" value="Website Enquiry" type="hidden" />
  <input name="send-email[body]" value="fields[message],fields[subject],fields[email],fields[name]" type="hidden" />

  <input id="submit" type="submit" name="action[save-message]" value="Send" />
 </fieldset>
 </form>

That code is in a utility that I call into my home page.

Basically the form is not working at all, I see no XML in the source, and I get the failure message.

What am I doing wrong?

Is the Save Message event attached to the page? If you change the action attribute of the form to ?debug do you see anything in the <events> node>

Yeah the event is attached. This is my XML.

<events>
    <login-info logged-in="true" id="1" user-type="developer" primary-account="yes">
        <name>Nick Toye</name>
        <username>NickToye</username>
        <email>nick@nicktoye.co.uk</email>
    </login-info>
</events>

By the way, on submission, is it supposed to show the debug page?

Right, slight typo, the action now directs to the debug page, and I get this xml:

<events>
    <login-info logged-in="true" id="1" user-type="developer" primary-account="yes">
        <name>Nick Toye</name>
        <username>NickToye</username>
        <email>nick@nicktoye.co.uk</email>
    </login-info>
    <save-message result="error">
        <message>Section is invalid</message>
    </save-message>
</events>

Looks like the section that your event is trying to save to no longer exists. What if you edit the Event, make sure the correct section is selected from the drop down, and save it.

Brilliant.

What the hell happened there then? Maybe it is like when you make a change in your sections and forget to resave the DS. Well it works now. Nice tip on the ?debug action. Thanks for that.

Nick

Also, the XML is still not showing up in the source. It’s not preventing me from using the form, it’s just bugging me.

Most likely you created your event but deleted and recreated the section. The section ID stored in the event is then old.

To get the XML back into your source (I presume you mean the events node in a comment at the bottom of your HTML) edit the manifest/config.php to set display_event_xml_in_source to yes. You’ll need to be logged in to Symphony to see this.

ah right so it’s not as default. That makes sense.

I’m having issues saving a comment and this is the output i get:

<save-comment result="error">
    <message>Entry encountered errors when saving.</message>
    <post type="missing" message="'Post' is a required field." />
    <post-values>
        <author>me</author>
        <email>me@em.com</email>
        <website>http://www.yoyo.com</website>
        <comment>hey ya!</comment>
        <article>92</article>
    </post-values>
</save-comment>

these are they two hidden fields i tried:

<input name="fields[post]" value="92" type="hidden" />

and

<input name="fields[posts]" value="92" type="hidden" />

where my section name is Posts. any clues as to why this comment is not saving?

also, how do you know what the input name should be if you’re posting to the server?

anyone know how the save comment event works? It’s the Post is need error that really gets me. I was looking at my Comments section and it has a section link with the name Post that is pointing to my Posts section Title field, but I am still getting this error. Any help is greatly appreciated!

If I recall correctly, section link (which is deprecated) doesn’t store IDs.

@wtdtan Can you post your log file?

@craig - meant select box link @rainer - where would i find the log files? the ones that get created in the manifest folder? if so, i don’t see anything but system/site info

@wtdtan You should set the right permissions to these folders. Also you can view log files through http://mywebsite.com/symphony/log/

http://mywebsite.com/symphony/system/log/ actually :)

oh wow. i never knew about that url, thanks brendo and rainer. I’ll take a look at this later and let you know what i find

strange. this started working for me again. I think I changed the select box link field name but never resaved the section. So i think I resaved the Comments section with the Post field selected and it started working again!

Hey,

I just ran into the exact same issue as Nick. It took me almost half a day to debug.

In my case I had indeed re-created my section “Messages” without knowing that under the hood Symphony uses IDs instead of names to link events to sections.

So all it takes to solve this issue is delete the event that isn’t working (because it was internally linked to the old section) and re-create an event with the exact same name.

I really wish I had known about this earlier. Hopefully someone else can benefit from this thread.

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