SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Aug 2006
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submit form via a text link?

    Is it possible to submit a form by clicking on a standard text hyperlink, rather than a submit button or image?

  2. #2
    SitePoint Enthusiast Insane_Edna's Avatar
    Join Date
    Oct 2003
    Location
    Alberta, Canada
    Posts
    37
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did a quick Google search on this as I thought it was an interesting question and I found the answer on this site here http://www.willmaster.com/possibilit...31230001.shtmlhttp://www.willmaster.com/possibilit...31230001.shtml

  3. #3
    SitePoint Wizard silver trophybronze trophy Nadia P's Avatar
    Join Date
    Oct 2004
    Location
    NSW Australia
    Posts
    3,564
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Without looking at the link provided by Insane, you could use css to remove any styling from the submit button, though it probably wouldn't work cross browser.

    Nadia

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's possible using some JavaScript, but it's far better to style a submit button to look like a link.

    The HTTP protocol states that GET requests (which is what you do with normal links) must be idempotent; i.e., they must not have any side effects. If your form is changing a database or a filesystem, you must not use GET. This means users don't expect any changes to be performed by clicking a link. Links are supposed to be 'safe'.
    Birnam wood is come to Dunsinane

  5. #5
    SitePoint Addict SwordsmanX's Avatar
    Join Date
    Sep 2005
    Posts
    211
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you want to do that in the first place? I know from experience that the situations in which forms should be broken are next to none..
    Whatever you may come up with, using a simple submit button will always be better :/

  6. #6
    SitePoint Evangelist Ed Seedhouse's Avatar
    Join Date
    Aug 2006
    Location
    Victoria, B.C. Canada
    Posts
    592
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SwordsmanX
    Why do you want to do that in the first place?
    Darned good question. In general users know how forms and buttons work and are used to them. They have an idea of how these things work and more or less expect any page they visit to work that way.

    Make them guess as to how to submit a form and you may find that, rather than do that, they simply go away, never to return.
    Last edited by HAWK; Dec 9, 2012 at 18:02.
    Ed Seedhouse

  7. #7
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sure,
    like this,
    <input type="img" src="image's url" />
    I'm glad to communicate technology of computer

  8. #8
    SitePoint Member therealfiredog69's Avatar
    Join Date
    Aug 2006
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do This....

    HTML Code:
    <form name="myForm" action="./gohere.php" method="GET">
         <input type="text" />
         <br /><br />
         <a href="#" onClick="myForm.submit();">Click here to submit form</a>
    </form>

  9. #9
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ... and if JavaScript is disabled or unsupported, there is no way to submit the form.
    Birnam wood is come to Dunsinane


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
  •