473,609 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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>

Oct 17 '05 #1
5 3451
Lee
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();

Oct 17 '05 #2
Lee wrote:
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();


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
Oct 17 '05 #3
RobG said the following on 10/17/2005 1:08 AM:
Lee wrote:
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();


That'll do the job, more formally:

document.forms['frmlateral'].submit();
is perhaps considered the 'correct' way.


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
Oct 17 '05 #4
Randy Webb wrote:
RobG said the following on 10/17/2005 1:08 AM:
Lee wrote:
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();

That'll do the job, more formally:

document.forms['frmlateral'].submit();
is perhaps considered the 'correct' way.

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?


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>


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.


The answer is if the name can't be used with dot notation then square
brackets are required.
--
Rob
Oct 17 '05 #5
Lee,
I worked perfectly. That's why I hate Microsoft products.... they are
made for lazy programmers!
Thank you very much!
Pascal

Lee wrote:
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();


Oct 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6111
by: Bart van Deenen | last post by:
Hi all I have a script where I dynamically create multiple inputs and selects from a script. The inputs and selects must have an associated onchange handler. I have the script working fine on Firefox, Safari and Konqueror, but the onchange event just doesn't fire on IE6. Firefox's javascript console shows no errors, and the IE script debugger shows nothing. onchange is not triggered.
2
4657
by: somaskarthic | last post by:
Hi In my php code , i dynamically created table rows on button click event. Each row contain 3 selectboxes, 7 checkboxes . On each click of these elements i need to submit the form and save the data to database. After each submit , i need to display the previous added details (with some checkboxes checked and some others unchecked ..) and one new row for next updation. Here i need to collect all values submitted in the php page. There i...
5
2789
by: Steve JORDI | last post by:
Just a question using images as submit buttons and PHP4.4.4. It seems that my code correctly works in FireFox but not in IExplorer. For example, I have a FORM with 2 buttons called "search" and "save". In a second file, the one mentioned in the "action" parameter, I test which button has been clicked in order to decide which action to take. IExplorer doesn't get anything, FireFox correctly works.
4
6665
by: =?Utf-8?B?YzY3NjIyOA==?= | last post by:
Hi all I have the following code: I am trying to use the value of the image button to evaluate what plan the user has chosen, i.e. it request("submit1")="Basic", then the user chose basic plan ... But when I click one of the image button, the thing is different from what I thought. it seems that it has field name like submit1.x=24&submit1.y=10, looks like the form submit swith the image button position values instead of the value
5
10100
by: atulvp | last post by:
Hi all, I have written a javascript code which changes the combo_2 options on runtime. It is working fine on IE but not working on Firefox. Please help me solve this problem. My code is as follows: function changeMe(str) { if(str.value == "se") { while(document.frm.combo2.length 0) {
1
3505
by: rynato | last post by:
I ran into an interesting problem while working on a form: I have a drop down list (think <form><select><option>...) of 'open sessions' which a user can choose from to continue entering data. There is a small bit of javascript which, when the 'onChange' event occurs, triggers a 'submit' which reloads the page and displays the stored values for that session using a session ID variable named, '$existingSessions'. Even though the form's...
10
8588
by: The Natural Philosopher | last post by:
I am coding up a bit of javascript stuff, and have managed to stumble my way through most of what I want.. But this one has got me stumped. I call submit() and get a javascript error 'Submit not defined' in Firefox.. My very expensive javascript Bible assures me its built in ..so where oh where have I FSCKED up?
22
1679
by: DL | last post by:
Hi, What I wanted to do is to call a function from a newly created element. But it stumbled me. Here's the line that references the newly created element and I used the alert function for debugging for now. Did I mess up all these quotes? // once again this is the key line of code, problem area, disregard
14
75476
by: white lightning | last post by:
How to have <select onchange="this.form.submit()"and also a Submit button on one form? I have something like this: <form action="<?php $_SERVER; ?>" method="post" enctype="multipart/form-data" name="form1"> <select onchange="this.form.submit();" name="prod"> <option value="">Select product</option> <option value="12">abc</option>
0
8557
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8513
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8205
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6983
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5504
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4007
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4066
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2519
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1638
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.