Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ansar 181 posts 291 karma points
    Nov 21, 2012 @ 09:28
    Ansar
    0

    Include page property, query string data or cookie value in the email

    I have added some enhancements to the XSLT to include page property, query string or cookie data along with the email.. If anyone interested see below

     

    1. Add a new Doc Type "Pliable Hidden" under "Pliable Fields" and add the following properties
      i. Name: Label, Alias: label, Type: Textstring
      ii. Name: Field Name, Alias: fieldName, Type: Textstring
      Allow this Doc Type under Pliable Form

    2. Open PliableForm.xslt and add the following code under renderForm template just inside the first <xsl:choose>

    <xsl:when test="name() = 'PliableHidden'">
    <xsl:variable name="propertyName" select="./fieldName" />
                  <input type="hidden" id="{$prefix}_{@id}" name="{$name}">  
    <xsl:attribute name="value">
    <xsl:choose>
    <xsl:when test="starts-with($propertyName, '#')"><!-- Query string --><xsl:value-of select="umbraco.library:Request(substring($propertyName, 2))"/></xsl:when>
    <xsl:when test="starts-with($propertyName, '%')"><!-- Cookie --><xsl:value-of select="umbraco.library:RequestCookies(substring($propertyName, 2))"/></xsl:when>
    <xsl:when test="starts-with($propertyName, '@')"><!-- umbraco property --><xsl:value-of select="$currentPage/@*[name()=substring($propertyName, 2)]"/></xsl:when>
    <xsl:otherwise><!-- page field --><xsl:value-of select="$currentPage/*[name()=$propertyName]"/></xsl:otherwise>
    </xsl:choose> 
    </xsl:attribute></input>
                </xsl:when>

    Now you can add a Pliable Hidden under a Pliable Form in the content section and use 

    - Use document type property name alias as it is. 
    - Use @ for built in Umbraco fields.  (eg:- @nodeName )
    - Use # for query string.  ( eg:- #id )
    - Use % for cookie value. (eg:- %language )

     

Please Sign in or register to post replies

Write your reply to:

Draft