Copied to clipboard

Flag this post as spam?

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


  • Anthony Candaele 1197 posts 2049 karma points
    Aug 31, 2011 @ 12:53
    Anthony Candaele
    0

    problems with search form

    Hi,

    Currently I'm implementing Examine search for a website. I have a problem with my webform:

    <form method="get" action="/search-results.aspx">
            <label<span>
              <input type="text" name="s" class="text" />
              </span>          
              <input type="image" src="/images/search_but.gif" class="button" value="" />
            </label>
          </form>

    If I hit the search button however, instead of a url query like this:

    http://localhost/search-results.aspx?s=congress

    I get a url query like this:

    http://localhost/search-results.aspx?s=congress&x=26&y=19

    I really don't know what's causing this extra &x=26&y=19 to be added to the querystring.

    Does anyone has experience with this problem?

    Thanks for your help,

    Anthony Candaele

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 31, 2011 @ 13:05
    Dirk De Grave
    1

    method="get" is the answer, change that to method="post" and you're good to go...

     

    Cheers,

    /Dirk

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Aug 31, 2011 @ 13:07
    Lee Kelleher
    1

    Hi Anthony,

    That is the default behaviour when you use the <input type=image>.  The X & Y co-ordinates are sent too.

    Not much you can do about it, see the W3C spec: http://www.w3.org/TR/html4/interact/forms.html#h-17.4.1

    Cheers, Lee.

  • Anthony Candaele 1197 posts 2049 karma points
    Aug 31, 2011 @ 13:08
    Anthony Candaele
    0

    Hi Dirk,

    I already tried that, if I change the method to method="post" then I get a url without querystring:

    http://localhost/search-results.aspx

    I wonder if this image button could be the problem (<input type="image" .../>)

    Thanks for your help,

    Anthony

     

  • Anthony Candaele 1197 posts 2049 karma points
    Aug 31, 2011 @ 13:10
    Anthony Candaele
    0

    @Lee I was afraid this was the case. Ok, thanks for the info, I'll try to implement a normal submit button

    greetings,

    Anthony

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Aug 31, 2011 @ 13:14
    Dirk De Grave
    0

    Yup, but you'd still be able to fetch the posted value using Request["s"]?

     

    Cheers,

    /Dirk

  • Lee Kelleher 4026 posts 15836 karma points MVP 13x admin c-trib
    Aug 31, 2011 @ 13:16
    Lee Kelleher
    1

    Hi Anthony,

    The alternative is to have a standard submit button and use CSS to style it accordingly (with a "background-image").

    Some examples on this website: http://cssbutton.com/forms/

    Cheers, Lee.

  • Anthony Candaele 1197 posts 2049 karma points
    Sep 01, 2011 @ 09:58
    Anthony Candaele
    0

    Hi Lee, problem solved, thanks for your tip concerning the styling of the submit button. This is really usefull because a lot of these commercial templates come with image buttons for their search form.

    greetings,

    Anthony Candaele

Please Sign in or register to post replies

Write your reply to:

Draft