Button submit form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Frank

    Button submit form

    Does anyone know why this doesn't seem to work on certain browsers /
    versions?

    <form name="formulier " action="script. cgi" method="post">
    <a href="#" onClick="docume nt.formulier.su bmit()"><img src="button.gif "
    border="0" ></a>
    </form>




  • Richard Cornford

    #2
    Re: Button submit form

    "Frank" <fsachs78@hotma il.co> wrote in message
    news:4006610a$0 $277$19deed1b@n ews.inter.NL.ne t...[color=blue]
    >Does anyone know why this doesn't seem to work on certain
    >browsers / versions?
    >
    ><form name="formulier " action="script. cgi" method="post">
    ><a href="#" onClick="docume nt.formulier.su bmit()"><img
    >src="button.gi f" border="0" ></a>
    ></form>[/color]

    Lots of possible reasons:-

    1. JavaScript disabled/incapable browsers will not execute the onclick
    attribute code at all.

    2. The onclick code does not cancel the navigation so if the form has
    not been submitted (actually sent) when the navigation specified in the
    HREF occurs the browser might be assuming that the user has changed
    their mind and stop/cancel the submit to act on the user's second
    request (as there is no longer any need to display the result of the
    form submission, so why bother sending it).

    3. The browser is not making references to named form objects named
    properties of the document object (there are no standards that say they
    should) so the reference is not being resolved to the form and instead
    is generating a JavaScript error.

    4. Something else resulting form mark-up or JavaScript not shown above.

    But the design is stupid as submitting a form by clicking on an image is
    easily achieved using an <input type="image" ... > element. Requiring no
    JavaScript at all.

    Richard.


    Comment

    Working...