SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2001
    Location
    London
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form submit with an image

    I am trying to submit a form whilst within a layer using an image instead of the button. For some reason this does not work!

    This is the code I have used:


    <form name="SearchForm" action="../search/searchresults.asp?Action=Go" method="post">
    <table border=0 cellpadding=3 bgcolor=C6E7FF><tr><td>
    <input type=text id='Keyword' name='Keyword'></input>&nbsp;
    <a href='#' onclick='document.SearchForm.submit();'><img src='../images/searchgo.gif' width='15' height='15' border='0' name='Keywords' type='image' id='Keywords' value='Go'></a><br>
    <a class="index" href="../search/advsearch.asp">Advanced Search</a>
    </td></tr></table></form>

    Any ideas - much appreciated.

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2001
    Location
    London
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Form submit with an image

    Having problems submitting the form using an image: Code below:

    <form name="SearchForm" action="../search/searchresults.asp?Action=Go" method="post">
    <table border=0 cellpadding=3 bgcolor=C6E7FF><tr><td>
    <input type=text id='Keyword' name='Keyword'></input>&nbsp;
    <a href='#' onclick='document.SearchForm.submit();'><img src='../images/searchgo.gif' width='15' height='15' border='0' name='Keywords' type='image' id='Keywords' value='Go'></a><br>
    <a class="index" href="../search/advsearch.asp">Advanced Search</a>
    </td></tr></table></form>

    Any ideas - much appreciated.

  3. #3
    This is all Mumbo Jumbo Amit's Avatar
    Join Date
    Oct 2001
    Location
    New Delhi, India
    Posts
    277
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can try any of the following ...

    <input type='image' src='.....' ... >

    OR

    <img src='...' onClick='document.SearchForm.submit();' ... >

  4. #4
    Say WHA?! goober's Avatar
    Join Date
    Sep 2000
    Location
    United States
    Posts
    1,921
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This would perhaps generate a better response if it was placed in the Client-Side Scripting Category of these forums. That's the part that deals with all the JavaScript that the client side of things uses.

    I'll see if I can get someone to move it there for you.
    Sean Killeen [LinkedIn] [Twitter] [Web]

    Warning: Reality.sys corrupted. Universe halted. Reboot? (Y/N)

  5. #5
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Done.

  6. #6
    SitePoint Guru
    Join Date
    Sep 1999
    Location
    Singapore
    Posts
    854
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Instead of <a href="....><img....></a>

    Try this:

    Code:
    <input type="image" src="../images/searchgo.gif" width="15" height="15" border="0" name="Keywords">

  7. #7
    SitePoint Evangelist
    Join Date
    Jun 2001
    Location
    London
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cheers


    Thanks so much.

    Placing the query in the right section is a good start..

    Thanks again....

  8. #8
    SitePoint Guru
    Join Date
    Aug 2001
    Location
    Amsterdam
    Posts
    788
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    search/searchresults.asp?Action=Go"
    Why do you use this type and not just a hidden input to define action=go

    I tryed stuff also a couple of times like that and it came back with some errors or it wouldn't except vars from my form..

    I would just use this:
    PHP Code:

    <form name="SearchForm" action="../search/searchresults.asp" method="post"

    <
    input type=hidden name=action value=go>

    <
    table etcetc...... 
    the neigbours (free) WIFI makes it just a little more fun


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •