form submit problem

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

    form submit problem

    Hello,

    i try to submit a form with textlink like this snippet:

    <a href="javascrip t:document.best ellen.submit()" >bestellen</a>
    <form name="bestellen " method="post"
    action="myPage. cfm?ID=4300&do= action">
    <input name="category" type="hidden" value="2">
    <input name="Product" type="hidden" value="423">
    <input name="Price" type="hidden" value="15">
    <input name="action" type="hidden" value="basket">
    <input name="Quantity" type="hidden" id="Quantity" value="1">
    </form>

    but this results in a javascript error: this object dont use that method (or
    something, its in german).

    Where am i wrong here?


    Thanks for any help,
    Martin Nadoll


  • Dennis Biletsky

    #2
    Re: form submit problem


    "Martin Nadoll" <martin@nadoll. de> ???????/???????? ? ???????? ?????????:
    news:c945rh$m58 $02$1@news.t-online.com...[color=blue]
    > Hello,
    >
    > i try to submit a form with textlink like this snippet:
    >
    > <a href="javascrip t:document.best ellen.submit()" >bestellen</a>
    > <form name="bestellen " method="post"
    > action="myPage. cfm?ID=4300&do= action">
    > <input name="category" type="hidden" value="2">
    > <input name="Product" type="hidden" value="423">
    > <input name="Price" type="hidden" value="15">
    > <input name="action" type="hidden" value="basket">
    > <input name="Quantity" type="hidden" id="Quantity" value="1">
    > </form>
    >
    > but this results in a javascript error: this object dont use that method[/color]
    (or[color=blue]
    > something, its in german).
    >
    > Where am i wrong here?
    >
    >
    > Thanks for any help,
    > Martin Nadoll[/color]

    I have checked this piece of code in Mozilla/5.0 (Windows; U; Windows NT
    5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8 and MSIE
    6.0.2800.xpclnt _qfe.021108-2107 and it works fine in both.


    Comment

    • Thomas 'PointedEars' Lahn

      #3
      Re: form submit problem

      Martin Nadoll wrote:
      [color=blue]
      > i try to submit a form with textlink like this snippet:
      >
      > <a href="javascrip t:document.best ellen.submit()" >bestellen</a>[/color]

      That's nonsense. "javascript :" is nonsense (see the FAQ) and nobody
      can order without support for client-side scripting, although that would
      not be necessary. Besides, the standards compliant reference would be

      document.forms['bestellen'].submit();

      If you have still problems with this, maybe the cause is that the "form"
      element is located *after* the "link" or you may have tested with IE and
      slided on the shared namespace of variables and element names/IDs in its DOM.
      [color=blue]
      > <form name="bestellen " method="post"
      > action="myPage. cfm?ID=4300&do= action">
      > <input name="category" type="hidden" value="2">
      > <input name="Product" type="hidden" value="423">
      > <input name="Price" type="hidden" value="15">
      > <input name="action" type="hidden" value="basket">
      > <input name="Quantity" type="hidden" id="Quantity" value="1">
      > </form>
      >
      > but this results in a javascript error: this object dont use that method (or
      > something, its in german).[/color]

      With which user agent have you tested?
      [color=blue]
      > Where am i wrong here?[/color]

      The code is error-prone and unreliable. Use something like

      <form
      name="bestellen "
      method="post"
      action="myPage. cfm?ID=4300&amp ;do=action">
      <input type="hidden" name="category" value="2">
      <input type="hidden" name="Product" value="423">
      <input type="hidden" name="Price" value="15">
      <input type="hidden" name="action" value="basket">
      <input type="hidden" name="Quantity" id="Quantity" value="1">
      <input type="submit" value="Bestelle n">
      </form>

      instead. (If you don't like the style of the "submit" button, you can
      change that with CSS [e.g. you can make it look like a link if you like].
      You can even use type="image" to use an image as submit button. In
      contrast to your present code, a submit button will work everywhere
      [although type="image" support is restricted to more recent browsers].)


      HTH

      PointedEars

      P.S.: de.comp.lang.ja vascript exists :)

      Comment

      Working...