Search

I am new with symphony and I'm working on an entry form in the front end, but i'm stuck with customizing my error messages after saving... I managed to get a general message (after going through the beginners guide): "Entry encountered errors when saving.44" or "Entry created successfully"

what i would like is that the specific "error entry field" appears red and a message says: "this is a required field" (for example)

An other problem is, I made an URI field, but if i do not enter the whole url with http:// the form does not accept it. how do i change the settings, that also url's like this would be accepted: www.something.com (without http://)

this is my template:

<script src="https://gist.github.com/3440041.js?file=master.xsl"></script>

do I need a java script? I need some small hints, thanks!

sorry, this is what i have in my template: http://xpathr.com/view/3440041/

what i would like is that the specific "error entry field" appears red and a message says: "this is a required field" (for example)

Here's one example of how you could do this:

<label class="six columns">
    <input name="fields[Name]" placeholder="Name" type="text" />
    <xsl:if test="events/submit-as-musician/name[@type='missing']>
            <span class="error">This is a required field.</span>
    </xsl:if>
</label>

An other problem is, I made an URI field, but if i do not enter the whole url with http:// the form does not accept it.

I assume you have selected the "URI" validation in your text input field? If that is the case, you can modify the validation REGEX so the http:// part is not required.

There are some alternatives:

  • use Javascript to add the http:// for the user before saving, or
  • modify your event so that it adds the http:// for the user.

there is a closing " missing in the code, so if anyone else needs it, this is the fixed code:

<xsl:if test="events/submit-as-musician/name[@type='missing']">
        <span class="error">This is a required field.</span>
</xsl:if>

yes, this brings me one step further, but if i ad this to my email or url field, obviously the error message only appears, when the text is missing and not if it does not match the validation rule (for example a missing @). do i have to ad an other error field? something like [@type='invalid']


for my url issue, i had a look at my validation regex:

'URI' => '/^[^s:/?#]+:(?:/{2,3})?[^s./?#]+(?:.[^s./?#]+)*(?:/[^s?#]*??[^s?#]*(#[^s#]*)?)?$/',

to delete the http:// how do i modify the code? i tried to edit the first part of the code , but it seems like i did not understand it yet:

'URI' => '/^(?:/{2,3})?[^s./?#]+(?:.[^s./?#]+)*(?:/[^s?#]*??[^s?#]*(#[^s#]*)?)?$/',

sorry if my questions are too basic... if anybody knows a useful tutorial, please let me know!

do i have to ad an other error field? something like [@type='invalid']

Most fields provide a meaningful error message for events. So you could modify your XSL to something like

<xsl:if test="events/submit-as-musician/name[@type='missing' or @type='invalid']">
    <span class="error">
        <xsl:value-of select="events/submit-as-musician/name/@message"/>
    </span>
</xsl:if>

You can, of course, choose custom error messages depending on the error @type. The excellent form controls utility by @nickdunn can help you to build great forms, including erros messages.

i'm stuck... symphony seems to be a level too hard for me. ;-( I've spent days trying to learn how to build a simple form, i tried to build it again with the «form controls» utility of @nickdunn but i don't see through yet. is there anyone who is willing to help me fixing my bugs? a skype call would be perfect. i would really appreciate!

Sure, I'm happy to walk you through the steps. Email me at allen (at) this domain and we can find a time to do the Skype call.

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