Copied to clipboard

Flag this post as spam?

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


  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 21, 2011 @ 16:14
    Fuji Kusaka
    0

    How to trigger a value in dropdown list

    Can someone point out how to i get to trigger a link to a node when selecting the value from a drop down list. I actually have a select drop down list where i populate a list of node.

    <select name="tourism" id="test">
      <option value="0">Please Choose</option>
        <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
          <option value="{@id}">
              <xsl:value-of select="@nodeName"/>
          </option>
       
       </xsl:for-each>
    </select>

     

    //fuji

     

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Jul 21, 2011 @ 16:24
    Tom Fulton
    0

    You would need to use some javascript.  Here is a quick example using some jquery (not tested)

    <select id="test" onChange="redir($('#test option:selected').attr('value'));">
      <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
        <option value="{umbraco.library:NiceUrl(@id)}">
          <xsl:value-of select="@nodeName"/>
        </option>
      </xsl:for-each>
    </select>
    <script type="text/javascript">
    function redir(rpath) {
     location = rpath;
    }
    </script>

    Here's also another example of the same thing on Tim's blog, using old schema and jquery-less:  http://www.nibble.be/?p=32

    -Tom

  • Fuji Kusaka 2203 posts 4220 karma points
    Jul 21, 2011 @ 16:31
    Fuji Kusaka
    0

    Hey Tom,

    Thanks for the response. I got it working like this as well

    <select name="tourism" id="test" onChange="window.open(this.options[this.selectedIndex].value,'_self')">
      <option value="/">Please Choose</option>
        <xsl:for-each select="umbraco.library:GetXmlNodeById($source)/* [@isDoc and string(umbracoNaviHide) != '1']">
          <option value="{umbraco.library:NiceUrl(@id)}">
              <xsl:value-of select="@nodeName"/>
          </option> 
       </xsl:for-each>
    </select>

     

    But thanks

    //fuji

     


  • 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