Submit working only in FF

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

    Submit working only in FF

    Hi!

    Firstly I have to tell that my english isn't perfect, so forgive me for
    that.

    Second: I have little problem with this code:

    <a href="javascrip t:;" title="Edit"
    onclick="docume nt.formularz.ed ited_param_id.v alue='0';docume nt.formularz.su bmit()">Edit&nb sp;&laquo;</a>

    It's working fine only in Firefox 0.9, but why not in IE or Opera ?
    Where is the bug ?

    --
    Regards, Caesar.
    =============== =============== ==
  • Lee

    #2
    Re: Submit working only in FF

    Cezar said:[color=blue]
    >
    >Hi!
    >
    >Firstly I have to tell that my english isn't perfect, so forgive me for
    >that.
    >
    >Second: I have little problem with this code:
    >
    ><a href="javascrip t:;" title="Edit"
    >onclick="docum ent.formularz.e dited_param_id. value='0';docum ent.formularz.s ubmit()">Edit&n bsp;&laquo;</a>[/color]


    You're telling the browser to do two different things at the same time:
    1. submit the form
    2. follow the link in the HREF attribute, and so stay on the same page.

    If you don't want to follow the link in the HREF attribute, you
    should always return false from the onclick handler.

    Comment

    • Cezar

      #3
      Re: Submit working only in FF

      Lee napisa³(a):
      [color=blue]
      > You're telling the browser to do two different things at the same time:
      > 1. submit the form
      > 2. follow the link in the HREF attribute, and so stay on the same page.
      >
      > If you don't want to follow the link in the HREF attribute, you
      > should always return false from the onclick handler.
      >[/color]

      You right! Now working fine.

      Thank You.

      --
      Regards, Cezar.
      =============== =============== ==
      Internet Explorer? Powinni tego zabroniæ.... :-P
      " ..posiada modu³ telepatyczny.." - przysz³e opcje przegl±darek

      Comment

      • Robert

        #4
        Re: Submit working only in FF

        In article <ci6tpf$ojk$1@a tlantis.news.tp i.pl>,
        Cezar <cezaryk@imail. net.pl> wrote:

        [color=blue]
        > <a href="javascrip t:;" title="Edit"
        > onclick="docume nt.formularz.ed ited_param_id.v alue='0';docume nt.formularz.su bmi
        > t()">Edit&nbsp; &laquo;</a>[/color]


        You are using a link to submit a form. While I have not seen the web
        page, it is best to be consistent as possible. Links are for
        navigation. Buttons are used to submit forums.

        Here is an example of validating a forum then submitting the form.

        Robert

        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
        <html>
        <head>
        <title>Check a form field</title>

        <script type="text/javascript">

        function validate(x)
        {
        var submitOK = true;
        var messageText =
        "What a suprise! Please correct the error in your ways." +
        " Please remove the asterisk ( * ) in the name field.";

        if (x.elements["theName"].value.indexOf( "*") >= 0)
        {
        alert(messageTe xt);
        submitOK = false;
        }

        return submitOK;
        }

        </script>
        </head>
        <body>
        <p>
        This html file shows how to cancel a submit.
        To cancel the submit, place an asterisk ( * ) in the name field.
        </p>
        <form name="myForm"
        action="http://www.natAValidWe bAddress.com"
        method="POST"
        onsubmit="retur n validate(docume nt.forms['myForm']);">
        <p>Name:<br>
        <input type="text" name="theName" size="20"></p><br><br>
        <input type="submit" value="Please submit">
        </form>
        </body>
        </html>

        Comment

        Working...