none
Custom Display Form

    Question

  • Hello,

    I'm using Sharepoint Foundation 2010.  I have a List with a Choice column using Checkboxes.  In the Add new item form the Checkboxes are vertical and you just go down the list and check the Checkboxes.  After you add the new item and then go to view the new item the Display form shows the checked items horizontally with a comma separating the the choices.  Is there a way using Sharepoint Designer to configure the choices in the Display form to display vertically without commas?  Below is the code in Sharepoint Designer that displays the checked boxes.

    <td width="400px" valign="top" class="ms-formbody">
     <xsl:value-of select="@Aging_x0020_Col1"/>
    </td>

    Thanks.

    Russ

    Friday, March 02, 2012 5:54 PM

Answers

  • Hi Russ9,

    Please replace <xsl:value-of select="@Aging_x0020_Col1"/> with following code.

    <xsl:call-template name="StrSplit">
       <xsl:with-param name="str" select="@Aging_x0020_Col1" />
    </xsl:call-template>

    Then copy following template outside the other templates. This template is used to split Aging_x0020_Col1 filed with commas and output substrings in separate line.

    <xsl:template name="StrSplit">
        <xsl:param name="str" />
        <xsl:choose>
            <xsl:when test="contains($str, ',')">
                 <xsl:value-of select="substring-before($str,',')" /> <br />
                 <xsl:call-template name="StrSplit">
                   <xsl:with-param name="str" select="substring-after($str, ',')" />
                 </xsl:call-template>
           </xsl:when>
           
           <xsl:otherwise>
            <xsl:value-of select="$str" />
           </xsl:otherwise>
       </xsl:choose>  
    </xsl:template>

    Best regards,
    Emir


    Emir Liu

    TechNet Community Support


    Monday, March 05, 2012 7:46 AM

All replies

  • Hello,

    I'm using Sharepoint Foundation 2010.  I have a List with a Choice column using Checkboxes.  In the Add new item form the Checkboxes are vertical and you just go down the list and check the Checkboxes.  After you add the new item and then go to view the new item the Display form shows the checked items horizontally with a comma separating the the choices.  Is there a way using Sharepoint Designer to configure the choices in the Display form to display vertically without commas?  Below is the code in Sharepoint Designer that displays the checked boxes.

    <td width="400px" valign="top" class="ms-formbody">
     <xsl:value-of select="@Aging_x0020_Col1"/>
    </td>

    Thanks.

    Russ

    Friday, March 02, 2012 5:55 PM
  • Hi Russ9,

    Please replace <xsl:value-of select="@Aging_x0020_Col1"/> with following code.

    <xsl:call-template name="StrSplit">
       <xsl:with-param name="str" select="@Aging_x0020_Col1" />
    </xsl:call-template>

    Then copy following template outside the other templates. This template is used to split Aging_x0020_Col1 filed with commas and output substrings in separate line.

    <xsl:template name="StrSplit">
        <xsl:param name="str" />
        <xsl:choose>
            <xsl:when test="contains($str, ',')">
                 <xsl:value-of select="substring-before($str,',')" /> <br />
                 <xsl:call-template name="StrSplit">
                   <xsl:with-param name="str" select="substring-after($str, ',')" />
                 </xsl:call-template>
           </xsl:when>
           
           <xsl:otherwise>
            <xsl:value-of select="$str" />
           </xsl:otherwise>
       </xsl:choose>  
    </xsl:template>

    Best regards,
    Emir


    Emir Liu

    TechNet Community Support


    Monday, March 05, 2012 7:46 AM
  • Thank you.

    Russ

    Wednesday, March 07, 2012 11:24 AM