Copied to clipboard

Flag this post as spam?

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


  • Profiterole 232 posts 264 karma points
    Jun 09, 2010 @ 19:52
    Profiterole
    0

    Get last approuved even if empty

    Hi,

    I created a form with "Name" mandatory field and "City" not mandatory field. With an xslt file, I display the last entries. But, if there is no City entered, instead of displaying nothing, it displays the last City entered.

    For instance, Joe New York, will display Joe - Toronto. But if someone does not enter his city : Doug, it will display Doug - Toronto.

    I can I correct that to display nothing if the personne entered nothing?

    Here's my xslt :

    <xsl:variable name="records" select="umbraco.contour:GetRecordsFromForm('d199f214-bc01-48c3-a0aa-ceeb266a56b4')/uformrecord[state = 'Approved']"/>

    <xsl:template match="/">

    <xsl:value-of select="$records//fields//name//value"/> - <xsl:value-of select="$records//fields//city//value"/>
  • Harald Ulriksen 207 posts 249 karma points
    Jun 10, 2010 @ 10:56
    Harald Ulriksen
    0

    Hi there,

    this is a simple xslt issue. You need to get the last uformrecord before displaying the field values, //uformrecord[last()]/fields/name/value and //uformrecord[last()]/fields/city/value on the records and then go for the /fields/name/value (try to use single / instead of // where possible).

    Hope this helps,
    Harald.

Please Sign in or register to post replies

Write your reply to:

Draft