Search

@nick is this possible to run form controls with Frontend membership? Members use fields[username-and-password][username] and fields[username-and-password][password]

Nope, this most likely won’t work.

@nick, filter messages like below (utilizing EventEx here):

<save-new-student>
    <entry result="error" section-id="15" section-handle="members">
        <filter name="waiver" status="failed">You must agree to the terms and conditions by checking the waiver box.</filter>
        <post-values>
            <title>Dr.</title>
            <first-name>Bob</first-name>
            <middle-name>David</middle-name>
            <relationships>59659</relationships>
        </post-values>
        <message>Entry encountered errors when saving.</message>
    </entry>
</save-new-student>

Does someone mind posting a sample of how to use this utility to create custom “error” and “success” messages? I cannot figure out how to correctly call the template to save my life…I am currently using the below code to call the standard messages:

<xsl:apply-templates select="events/email"/>

and

<xsl:template match="events/email">
<p>
    <xsl:attribute name="class"><xsl:value-of select="@result"/></xsl:attribute>
    <xsl:value-of select="message"/>
</p>
</xsl:template>

Huge thanks in advance.

Have you tried the README? There most basic example shows something like this:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:exsl="http://exslt.org/common"
    xmlns:form="http://nick-dunn.co.uk/xslt/form-controls"
    extension-element-prefixes="exsl form">

<!-- Import form-controls.xsl -->
<xsl:import href="../utilities/form-controls.xsl"/>

<!-- Define a global variable pointing to your Event -->
<xsl:variable name="form:event" select="/data/events/save-blog-post"/>

<xsl:template match="data">

    <xsl:call-template name="form:validation-summary"/>

    <form action="" method="post">
        <!-- your form in here -->
    </form>

</xsl:template>

</xsl:stylesheet>

You can then modify the validation-summary template (see the form:validation-summary heading in the README for full instructions).

Hey Nick, thanks for being a patient legend…I totally missed the following part in the README:

`<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:form="http://nick-dunn.co.uk/xslt/form-controls"
extension-element-prefixes="exsl form">`

I can now get the HTML right with the form (it posts correctly, etc), but no validation is being displayed. My code: Pastie

I have tried many different things (scoured the README, tried to edit the utility, did a XML dance, etc), but to no avail. Any help would be incredibly appreciated.

The XPath to your event looks like it might be wrong. Should it be:

<xsl:variable name="form:event" select="/data/events/email"/>

Son of a $#%$#!!! Nick, I hope that one day I can give you a hug. I swear that XPath was correct at one point…huge thank you, bro.

Hello everyone!

Can't figure out how to use the utility with "selectbox_link" field. Do i need Section Schemas or something?

Can't figure out how to use the utility with "selectbox_link" field. Do i need Section Schemas or something?

I create a separate minimal data-source to get all entries with a link.

When I use the form:label template, the page comes up blank. Is there any reason why this would be happening?

Hey, Nick! This is fantastic. It works pretty well. But I was wondering what would be the best way to add extra HTML5 data- attributes to the select options, let's say:

<option value='x' data-something='y'>This is an option</option>

I read your code and it seems you are using a conditional to check out if there is @handle, @id or @link-id (among others) in each option in the $options parameter:

<option>
         <xsl:if test="@handle or @id or @link-id or @link-handle or @value">
           <xsl:attribute name="value">
                  <xsl:value-of select="@handle | @id | @link-id | @link-handle | @value"/>
               </xsl:attribute>
         </xsl:if>
         <xsl:value-of select="text()"/>
</option>

How do you think would be the best way to deal with this?

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