Copied to clipboard

Flag this post as spam?

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


  • syn-rg 282 posts 425 karma points
    Nov 02, 2012 @ 07:14
    syn-rg
    0

    Search by selected keyword checkbox

    I've created a keyword's property type using the textbox multiple data type.

    The keywords are then seperated into a list of words or phrases seperated by commas.

    I've wrapped the keywords in A tag with the href linking to my search page, and including the value of the keyword so that all nodes with the same keyword will display in my search.

    I want to add an option where a user can select from checkboxes with the value of the keyword, and submit a search so all checked keywords are included in the search.

    I need help with figuring out how to get the checked values of the list of keyword checkboxes to submit and display the results on my seach page.

    Here is what I have so far, which doesn't submit and I can't find where to add the values of the checkboxes:

    <xsl:if test="string($currentPage/keywords) != ''">
    
    <!-- get the contents of the textbox multiple, with commas -->
    <xsl:variable name="textWithBrs" select="umbraco.library:ReplaceLineBreaks($currentPage/keywords)"/>
    
    <!-- replace commas with pipes so you can use Split -->
    <xsl:variable name="textWithPipes" select='umbraco.library:Replace($textWithBrs, ", ", "|")'/>
    
    <!-- split into an array of items and output as unordered list -->
    <xsl:variable name="items" select="umbraco.library:Split($textWithPipes, '|')"/>
    <ul>
      <xsl:for-each select="$items/value">
        <li>
          <input type="checkbox" value="true" keyword="{.}" id="{.}" name=""/>
          <a>
          <xsl:attribute name="href"> <xsl:text disable-output-escaping="yes">/imagery/image-search.aspx
          <![CDATA[?]]>
          search=</xsl:text> <xsl:value-of select="." /> </xsl:attribute>
          <xsl:attribute name="title"> <xsl:value-of select="."/> </xsl:attribute>
          <xsl:value-of select="."/> </a> </li>
      </xsl:for-each>
    </ul>
    <input type="submit" value="Search" id="btnSearchBottom" name="" onclick="location.href='/imagery/image-search.aspx?search=otbra'" />
    </xsl:if>
    

    Any assistance would be greatly appreciated.

    Cheers, JV

     

     

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies