SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2003
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    forms and post data question

    I know you can submit post data through a form. What I want to do though is instead of having a button that you press to submit the data I want to submit data via post when the user clicks on a link. Is there anyway I can do this using links and not submit buttons?

  2. #2
    SitePoint Addict xDev's Avatar
    Join Date
    Jul 2003
    Location
    Moncton, New Brunswick, Canada
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Yes. You'll have to use javascript though, html does not natively support such a feature.

    Code:
    <a href="#form" onclick="document.FORMNAME.submit();">Submit this form</a>
    This could present accessibility problems. The last I checked, javascript is disabled on 14% of client computers. For those who have it disabled, they will not be able to submit your form. It's much better to have a submit button. Forms should always be the most accessible part of your website.

    -xDev


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
  •