Copied to clipboard

Flag this post as spam?

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


  • Bas Wensveen 54 posts 75 karma points
    Apr 18, 2010 @ 15:54
    Bas Wensveen
    0

    A link instead of a button to start Xslt search

    Hi,

     

    Is there a way to replace the standard button (search) with a link as provided by the XSLT Search package. I tried serval options but did not succeed.

     

    Kind regards,

     

    Bas 

     

     

     

  • Stephan Lonntorp 195 posts 212 karma points
    Apr 18, 2010 @ 19:33
    Stephan Lonntorp
    0

    Since you need to post a form to the search page, you can only accomplish this either with a submit button, or using javascript to get the current value of the form field, and submit it to your search page.

  • Bas Wensveen 54 posts 75 karma points
    Apr 18, 2010 @ 20:00
    Bas Wensveen
    0

    Hi Stepan,

    I used javascript to do the submit. See the code below:

     

          function StartSearch() {
             document.zoekenForm.submit();
          }

     

         <form name="zoekenForm" method="get" action="/search.aspx?">
             <input id="ZoekTextBox" name="search2" type="text" />
             <a href="/search.aspx" onclick="StartSearch()">Zoeken</a>
          </form>
    

     

    But I don't get any search results. I do see that the submit is done!

     

    Regards

  • dillorscroft 198 posts 192 karma points
    Apr 18, 2010 @ 20:25
    dillorscroft
    0

    I'm no javascript expert but wouldnt that link still go to /search.aspx without submitting the form?

    Wouldn't it make more sense to link to href="#"?

    Also change the method to post in the form rather than get as you are not forwarding the search2 field in the URL.  Shouldnt the input field be something other than search2 to work with XSLT search.

    DC

  • Bas Wensveen 54 posts 75 karma points
    Apr 18, 2010 @ 20:48
    Bas Wensveen
    0

    Thanks!

    The href in the link did the trick. The name="search2" is lagecy from testing. The name should be search.

     

    Regards

     

     

Please Sign in or register to post replies

Write your reply to:

Draft