submit within onchange not working correctly in Firefox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Pascal Batzli Jr

    submit within onchange not working correctly in Firefox

    Hello,
    I have a strange situation happening on the code below. When I first
    load the page, as I change any of the three combo boxes I have created,
    the onchange event is fired and the form should be submitted, but it
    isn't for some weird reason. However, after I press the ok button, it
    submits the form, and then the combo boxes start working normally. In
    IE, everything works fine.
    I appreciate any help. Thank you.

    <html>
    <head>
    <title>.:Guimar &atilde;es Comercial:.</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <script language="javas cript">
    <!--
    function MM_openBrWindow (theURL,winName ,features) { //v2.0
    window.open(the URL,winName,fea tures);
    }
    //-->
    </script>

    </head>

    <body bgcolor="#FFFFF F" text="#000000"
    background="fig uras/laretal.jpg">
    <br>
    <form name="frmlatera l" method="post" action="lateral .asp">
    <p> <br>
    &nbsp;&nbsp;
    <select name="cbonivel1 " size="1"
    onChange="javas cript:atualizar ();">
    <option value=1 selected>Instru mentos</option>
    <option value=2>Móveis p/ Igreja</option>
    <option value=3>Diverso s</option>
    </select>
    <br>
    &nbsp;&nbsp;
    <select name="cbonivel2 " size="1"
    onChange="javas cript:atualizar ();">
    <option value=1 selected>Inst. De Corda</option>
    <option value=2>Inst. De Percusão</option>
    <option value=3>Inst. De Sopro</option>
    <option value=4>Inst. De Teclado</option>
    <option value=5>Listão Weril</option>
    </select>
    <br>
    &nbsp;&nbsp;
    <select name="cbonivel3 " size="1"
    onChange="javas cript:atualizar ();">
    <option value=1 selected>Violin o</option>
    <option value=2>Viola</option>
    <option value=3>Violonc ello</option>
    <option value=4>Contra Baixo (Rabecão)</option>
    <option value=5>Violões Yamaha</option>
    <option value=6>Violões Eagle</option>
    <option value=7>Violões Di Giorgio</option>
    <option value=8>Violões Importados</option>
    </select>
    <input type="submit" name="Submit" value="ok"
    onClick="javasc ript:busca1();" >
    </p>

    <p>&nbsp;</p>&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;&nbsp;&nbsp;& nbsp;&nbsp;&nbs p;
    <input type="text" name="textfield " size="8">
    <input type="submit" name="Submit2" value="ok">
    </form>
    <p><br>
    <object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000"
    codebase="http://download.macrom edia.com/pub/shockwave/cabs/flash/swflash..cab#ve rsion=5,0,0,0"
    width="150" height="160">
    <param name=movie value="figuras/banner.swf">
    <param name=quality value=high>

    <embed src="figuras/banner.swf" quality=high
    pluginspage="ht tp://www.macromedia. com/shockwave/download/index.cgi?P1_Pr od_Version=Shoc kwaveFlash"
    type="applicati on/x-shockwave-flash" width="150" height="160">
    </embed>
    </object> <br>
    <a href="#"
    onClick="MM_ope nBrWindow('aten dimento.htm','' ,'width=310,hei ght=240')"><img
    src="figuras/atendimento.jpg " width="146" height="43" border="0"></a>
    </p>
    </body>
    <script language="javas cript">
    function atualizar()
    {
    frmlateral.subm it();
    }

    function busca1()
    {
    alert("teste3") ;
    }
    </script>
    </html>

  • Lee

    #2
    Re: submit within onchange not working correctly in Firefox

    Pascal Batzli Jr said:[color=blue]
    >
    >Hello,
    >I have a strange situation happening on the code below. When I first
    >load the page, as I change any of the three combo boxes I have created,
    >the onchange event is fired and the form should be submitted, but it
    >isn't for some weird reason.[/color]
    [color=blue]
    > frmlateral.subm it();[/color]

    No, it's not weird at all. You're using an IE shortcut that Firefox and other
    browsers don't support. The correct way to refer to your form is:

    document.frmlat eral.submit();

    Comment

    • RobG

      #3
      Re: submit within onchange not working correctly in Firefox

      Lee wrote:[color=blue]
      > Pascal Batzli Jr said:
      >[color=green]
      >>Hello,
      >>I have a strange situation happening on the code below. When I first
      >>load the page, as I change any of the three combo boxes I have created,
      >>the onchange event is fired and the form should be submitted, but it
      >>isn't for some weird reason.[/color]
      >
      >[color=green]
      >> frmlateral.subm it();[/color]
      >
      >
      > No, it's not weird at all. You're using an IE shortcut that Firefox and other
      > browsers don't support. The correct way to refer to your form is:
      >
      > document.frmlat eral.submit();
      >[/color]

      That'll do the job, more formally:

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


      is perhaps considered the 'correct' way. Another is:

      document.forms. frmlateral.subm it();




      --
      Rob

      Comment

      • Randy Webb

        #4
        Re: submit within onchange not working correctly in Firefox

        RobG said the following on 10/17/2005 1:08 AM:[color=blue]
        > Lee wrote:
        >[color=green]
        >> Pascal Batzli Jr said:
        >>[color=darkred]
        >>> Hello,
        >>> I have a strange situation happening on the code below. When I first
        >>> load the page, as I change any of the three combo boxes I have created,
        >>> the onchange event is fired and the form should be submitted, but it
        >>> isn't for some weird reason.[/color]
        >>
        >>
        >>[color=darkred]
        >>> frmlateral.subm it();[/color]
        >>
        >>
        >>
        >> No, it's not weird at all. You're using an IE shortcut that Firefox
        >> and other
        >> browsers don't support. The correct way to refer to your form is:
        >>
        >> document.frmlat eral.submit();
        >>[/color]
        >
        > That'll do the job, more formally:
        >
        > document.forms['frmlateral'].submit();
        >
        >
        > is perhaps considered the 'correct' way.[/color]

        I have to ask a question I have asked in the past:

        Is there a known browser where document.forms['frmlateral']submit()
        submits the form but document.frmlat eral.submit() doesn't?

        The first assumes the named form is a property of the document object,
        the second one doesn't. So I guess the real question is if there is a
        known browser that doesn't make named forms a property of the document
        object.

        --
        Randy
        comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly

        Comment

        • RobG

          #5
          Re: submit within onchange not working correctly in Firefox

          Randy Webb wrote:[color=blue]
          > RobG said the following on 10/17/2005 1:08 AM:
          >[color=green]
          >> Lee wrote:
          >>[color=darkred]
          >>> Pascal Batzli Jr said:
          >>>
          >>>> Hello,
          >>>> I have a strange situation happening on the code below. When I first
          >>>> load the page, as I change any of the three combo boxes I have created,
          >>>> the onchange event is fired and the form should be submitted, but it
          >>>> isn't for some weird reason.
          >>>
          >>>
          >>>
          >>>
          >>>> frmlateral.subm it();
          >>>
          >>>
          >>>
          >>>
          >>> No, it's not weird at all. You're using an IE shortcut that Firefox
          >>> and other
          >>> browsers don't support. The correct way to refer to your form is:
          >>>
          >>> document.frmlat eral.submit();
          >>>[/color]
          >>
          >> That'll do the job, more formally:
          >>
          >> document.forms['frmlateral'].submit();
          >>
          >>
          >> is perhaps considered the 'correct' way.[/color]
          >
          >
          > I have to ask a question I have asked in the past:
          >
          > Is there a known browser where document.forms['frmlateral']submit()
          > submits the form but document.frmlat eral.submit() doesn't?[/color]

          I don't know.

          I just figured it was worth mentioning the various ways, since often
          (well, occasionally) a question is asked about how to access a form or
          form control where a string has been used for the name that can't be
          successfully used with dot notation, hence square brackets are
          required - e.g. name="form[6]".

          Perhaps I should have included that tidbit, or at least a reference to
          the appropriate FAQ section:

          <URL:http://www.jibbering.c om/faq/#FAQ4_36>

          [color=blue]
          >
          > The first assumes the named form is a property of the document object,
          > the second one doesn't. So I guess the real question is if there is a
          > known browser that doesn't make named forms a property of the document
          > object.
          >[/color]

          The answer is if the name can't be used with dot notation then square
          brackets are required.


          --
          Rob

          Comment

          • Pascal Batzli Jr

            #6
            Re: submit within onchange not working correctly in Firefox

            Lee,
            I worked perfectly. That's why I hate Microsoft products.... they are
            made for lazy programmers!
            Thank you very much!
            Pascal

            Lee wrote:[color=blue]
            > Pascal Batzli Jr said:[color=green]
            > >
            > >Hello,
            > >I have a strange situation happening on the code below. When I first
            > >load the page, as I change any of the three combo boxes I have created,
            > >the onchange event is fired and the form should be submitted, but it
            > >isn't for some weird reason.[/color]
            >[color=green]
            > > frmlateral.subm it();[/color]
            >
            > No, it's not weird at all. You're using an IE shortcut that Firefox and other
            > browsers don't support. The correct way to refer to your form is:
            >
            > document.frmlat eral.submit();[/color]

            Comment

            Working...