newbie question

Discussion in 'HTML' started by siliconmike, Aug 15, 2005.

  1. siliconmike

    siliconmike Guest

    I have a form inside which there are many links (not buttons).

    How can I post form data when user clicks on any of these links ? Do I
    need Javascript, or is this possible by regular html ?

    I believe that form data can be posted using HTML, only when user
    clicks on a button, right ?

    Mike
     
    siliconmike, Aug 15, 2005
    #1
    1. Advertising

  2. siliconmike

    Randy Webb Guest

    siliconmike said the following on 8/14/2005 8:51 PM:

    > I have a form inside which there are many links (not buttons).


    Use buttons, make them of type submit, and submit the form.

    > How can I post form data when user clicks on any of these links ?
    > Do I need Javascript, or is this possible by regular html ?


    Client-Side Scripting of some sort.

    >
    > I believe that form data can be posted using HTML, only when user
    > clicks on a button, right ?


    Or the Enter Key when a form field has focus.

    --
    Randy
    comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
     
    Randy Webb, Aug 15, 2005
    #2
    1. Advertising

  3. siliconmike

    Fly Cooter Guest

    In article <>,
    says...
    >
    >
    >I have a form inside which there are many links (not buttons).
    >
    >How can I post form data when user clicks on any of these links ? Do I
    >need Javascript, or is this possible by regular html ?
    >
    >I believe that form data can be posted using HTML, only when user
    >clicks on a button, right ?
    >
    >Mike


    Search Yahoo or Excite for "free form mailer" (without the quote marks)
    and you will find free services that do it for you, and they provide you
    with HTML code to paste.

    --
    Fly Cooter
    http://fly-cooter.tripod.com
     
    Fly Cooter, Aug 15, 2005
    #3
  4. siliconmike

    Toby Inkster Guest

    siliconmike wrote:

    > How can I post form data when user clicks on any of these links ? Do I
    > need Javascript, or is this possible by regular html ?


    It *can* be done with Javascript:

    <form id="myform" method="GET" action="handler.cgi">
    ....
    <a href="flibble.html" onclick="document.getElementById('myform').submit">
    ....
    </form>

    But that is probably a *very* bad idea. People expect to submit a form by
    clicking a button -- not by following a link. If you don't use a button to
    submit the form, then you may confuse your users.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Aug 15, 2005
    #4
  5. On Sun, 14 Aug 2005, Randy Webb wrote:

    > siliconmike said the following on 8/14/2005 8:51 PM:
    >
    > > I have a form inside which there are many links (not buttons).

    >
    > Use buttons, make them of type submit, and submit the form.


    Don't use <button>s, they aren't implemented to specification by MSIE.
    Use <input type=submit ....> controls, whose implementation is
    generally reliable. Identify which one was used by appropriate use of
    their name= and value= attributes.

    > > How can I post form data when user clicks on any of these links ?
    > > Do I need Javascript, or is this possible by regular html ?

    >
    > Client-Side Scripting of some sort.


    Don't rely unnecessarily on client-side scripting. Use it, if at all,
    only for an *optional* additional convenience.

    > > I believe that form data can be posted using HTML, only when user
    > > clicks on a button, right ?


    That's intentional: form submission by POST (as opposed to GET) is
    intended for actions which undertake some significant action, such as
    ordering a pizza, casting a vote, etc. As such, there should be no
    doubt in the user's mind as to whether they are undertaking this
    action. The design should, as far as possible, defend the user
    against inadvertent submission of such a request.

    > Or the Enter Key when a form field has focus.


    Some browsers do that, yes, although it's debatable whether it's
    correct behaviour by the browser, since it *can* result in a user
    inadvertently performing a POST request. Arguably, it should only
    happen when the focus has been placed on the "submit" control. But
    that's more a browser design issue, less a web page design issue.

    best regards

    [crossposted groups - I've proposed narrowed f'ups]
     
    Alan J. Flavell, Aug 15, 2005
    #5
  6. siliconmike

    Peter Flynn Guest

    Toby Inkster wrote:

    > siliconmike wrote:
    >
    >> How can I post form data when user clicks on any of these links ? Do I
    >> need Javascript, or is this possible by regular html ?

    >
    > It *can* be done with Javascript:
    >
    > <form id="myform" method="GET" action="handler.cgi">
    > ...
    > <a href="flibble.html" onclick="document.getElementById('myform').submit">
    > ...
    > </form>
    >
    > But that is probably a *very* bad idea. People expect to submit a form by
    > clicking a button -- not by following a link. If you don't use a button to
    > submit the form, then you may confuse your users.


    may ::= will

    :)

    ///Peter
    --
    sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
    &;top"
     
    Peter Flynn, Aug 16, 2005
    #6
  7. Toby Inkster wrote:
    > siliconmike wrote:
    >
    >>How can I post form data when user clicks on any of these links ? Do I
    >>need Javascript, or is this possible by regular html ?

    >
    > It *can* be done with Javascript:


    A less inaccessible (but still icky for other reasons) solution is to
    disguise a button as a link, as in <http://ecritters.biz/disguises/>.
     
    Leif K-Brooks, Aug 16, 2005
    #7
  8. siliconmike

    Nicknamezj Guest

    For you to POST the data your self you would need a severside script,
    (like: php or perl).
    Javascript can be used to use the data, but it can not post it because
    it's a clientside scripting. For the HTML, by its self can email you
    the data using the action="mailto:"
    looks like:

    <form action="mailto:?subject=your-subject" method="post"
    enctype="text/plain">

    And yes, you are right about the user needing to click the submit
    button.

    ~Nick
     
    Nicknamezj, Aug 18, 2005
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry C.
    Replies:
    8
    Views:
    245
    Uri Guttman
    Nov 23, 2003
  2. Kruno Saho
    Replies:
    0
    Views:
    143
    Kruno Saho
    Apr 7, 2013
  3. Dave Angel
    Replies:
    0
    Views:
    125
    Dave Angel
    Apr 7, 2013
  4. rusi
    Replies:
    0
    Views:
    112
  5. Miki Tebeka
    Replies:
    0
    Views:
    84
    Miki Tebeka
    Apr 7, 2013
Loading...

Share This Page