473,788 Members | 2,893 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

document.getEle mentById('myFor m').submit() does not work

Hi,

It looks like so many people are having problems with the javascript
submit in firefox. I searched around, but haven't found a solution
yet. Mostly, people were saying, try this or try that or maybe blah
blah or why do you wanna do that blah blah. I haven't seen a solution
to this problem.

OK, I am trying to share session objects between classic asp
applications and asp.net applications. If you insist in asking why I
wanna do this, because a big chunk of our web application was written a
few years ago in classic ASP, and I am gonna add new components to it
in ASP.NET (I don't wanna write in classic ASP).

So, I searched and found a very good solution to this problem at
http://www.eggheadcafe.com/articles/20021207.asp

That is a great strategy, but the automatic submit by the javascript
(shown below where 't' is the id of the form) in the hidden page works
for IE, but not for firefox.

<script>t.submi t();</script>

Please note that this is intended to *automatically* submit, in other
words, there are no button clicks.

I tried instead

document.getEle mentById(t).sub mit(); and
document.getEle mentById('t').s ubmit(); and
(document.getEl ementById('t')) .submit();

None of these worked for firefox.

I believe many out there are having the same problem. Any solution
yet? Thanks.

Sep 29 '06 #1
5 77637
VK

an***********@y ahoo.com wrote:
That is a great strategy, but the automatic submit by the javascript
(shown below where 't' is the id of the form) in the hidden page works
for IE, but not for firefox.
Check for two of the most common mistakes:

1) You form has *name* "t" and not id "t" - then naturally
getElementById is out of business here.

2) Your submit button in the form is called "submit":
<input type="submit" name="submit".. .Some badly written authoring
tools still do it by default and it nukes dot-based method accessor for
form submit.

3) The autoreferencing of ID'ed elements in the global scope is IE's
invention. Firefox alas does it too but in quirk mode. Use DOM 0 form
access methods, they are still the best (and no global scope
pollution):
<form name="t" action="...">

and then

document.forms['t'].submit()

or (if in another frame):

parent.frames['frameName'].document.forms['t'].submit()

If the problem persists it may be needed to see the relevant fragment
of your page (or a link).

Sep 29 '06 #2
VK wrote:
an***********@y ahoo.com wrote:
That is a great strategy, but the automatic submit by the javascript
(shown below where 't' is the id of the form) in the hidden page works
for IE, but not for firefox.

Check for two of the most common mistakes:

1) You form has *name* "t" and not id "t" - then naturally
getElementById is out of business here.

2) Your submit button in the form is called "submit":
<input type="submit" name="submit".. .Some badly written authoring
tools still do it by default and it nukes dot-based method accessor for
form submit.

3) The autoreferencing of ID'ed elements in the global scope is IE's
invention. Firefox alas does it too but in quirk mode. Use DOM 0 form
access methods, they are still the best (and no global scope
pollution):
<form name="t" action="...">

and then

document.forms['t'].submit()

or (if in another frame):

parent.frames['frameName'].document.forms['t'].submit()

If the problem persists it may be needed to see the relevant fragment
of your page (or a link).
Hi, VK, thanks a lot for your hint. I tried exactly as you instructed.
It still does not work. This one is really hard. Not sure why
Firefox does this.

Sep 30 '06 #3

an***********@y ahoo.com wrote:
[,,,]
Hi, VK, thanks a lot for your hint. I tried exactly as you instructed.
It still does not work. This one is really hard. Not sure why
Firefox does this.
Post an example where Firefox doesn't do "this" and IE does. Then
you'll get some precise help, rather than guesses.

The following example works in Firefox:

<form name="fred" action="">
<input type="text" value="blah" name="blahInput ">
</form>

<a href="#" onclick="docume nt.forms['fred'].submit();">Sub mit the form
"fred"</a>
Which shows that calling a form's submit method works, therefore the
error is elsewhere.
--
Rob

Sep 30 '06 #4
RobG wrote:
an***********@y ahoo.com wrote:
[,,,]
Hi, VK, thanks a lot for your hint. I tried exactly as you instructed.
It still does not work. This one is really hard. Not sure why
Firefox does this.

Post an example where Firefox doesn't do "this" and IE does. Then
you'll get some precise help, rather than guesses.

The following example works in Firefox:

<form name="fred" action="">
<input type="text" value="blah" name="blahInput ">
</form>

<a href="#" onclick="docume nt.forms['fred'].submit();">Sub mit the form
"fred"</a>
Which shows that calling a form's submit method works, therefore the
error is elsewhere.
--
Rob
Thanks. Rob,

The problem seems to be this: I need to include

<html><head><ti tle>Test</title></head><bodybefor e <formand then
</body></htmlafter </form>

for firefox to work. Whereas, IE does not care about "incomplete " HTML
page.

I tried this, if I don't make the HTML page complete with those basic
tags, then Firefox won't work for this snippet of code, otherwise, it
works.

A great lesson to learn.

Sep 30 '06 #5

an***********@y ahoo.com wrote:
RobG wrote:
an***********@y ahoo.com wrote:
[,,,]
Hi, VK, thanks a lot for your hint. I tried exactly as you instructed.
It still does not work. This one is really hard. Not sure why
Firefox does this.
Post an example where Firefox doesn't do "this" and IE does. Then
you'll get some precise help, rather than guesses.

The following example works in Firefox:

<form name="fred" action="">
<input type="text" value="blah" name="blahInput ">
</form>

<a href="#" onclick="docume nt.forms['fred'].submit();">Sub mit the form
"fred"</a>
Which shows that calling a form's submit method works, therefore the
error is elsewhere.
--
Rob

Thanks. Rob,

The problem seems to be this: I need to include

<html><head><ti tle>Test</title></head><bodybefor e <formand then
</body></htmlafter </form>

for firefox to work. Whereas, IE does not care about "incomplete " HTML
page.
There must be more to this than you've posted - head, body and HTML
tags are all optional. The code that I posted works in Firefox even it
that's all that's in the page. Add a doctype and title element and
it's valid HTML.
--
Rob

Sep 30 '06 #6

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

Similar topics

14
14189
by: Chris | last post by:
Heres my problem: <a href="javascript:void(document.buysell.submit())" target="_parent" onMouseOver="MM_swapImage('members','','images/membersf2.gif',1)" onMouseOut="MM_swapImgRestore()"><img src="images/members.gif" alt="Back to members page" name="members" width="270" height="25" border="0"></a> I get the error "document.buysell" is null or not an object, but my form name is buysell and when using the submit button, which is not
3
4678
by: Don | last post by:
I can successfully force submission of a <form> using "document.formname.submit()". But, the submission doesn't appear to occur when used with Netscape. Anybody know why this is happening, and what I can do to get around this? Thanks, Don -----------== Posted via Newsfeed.Com - Uncensored Usenet News ==---------- http://www.newsfeed.com The #1 Newsgroup Service in the World!
2
16349
by: Alex | last post by:
Hello, I use the following script inside a page. My page contains : 1 FORM, Some Hidden fields, and one line of JAVASCRIPT in order to instantly post the Form. The problem is that under FIREFOX, the JAVASCRIPT line don't seems to be correct, because FIREFOX does'nt post the Form... But my javascript line looks correct to me... Below is the Script; thanks for your Help in advance.
5
33881
by: terence.parker | last post by:
I have a PHP application which I wrote last year - and the JavaScript worked fine then. For some reason, now it doesn't - neither on IE nor Firefox. Has something changed? When I click on my HTML link now (which executes a JS function), the firefox JS console tells me: Error: document.SubjectsForm.submit is not a function Any help would be much appreciated. Thanks!
8
17888
by: Ed Jay | last post by:
Is there a way to use 'document.form.submit()' to submit a form to a url other than that specified in the Form element? -- Ed Jay (remove M to respond by email)
4
16283
by: dschruth | last post by:
Hello. Can anybody solve this problem? I am using a server-side language (PERL) to *try* to POST data to a HTTPS login script that doesn't have a standard "submit" button. The form appears to use javascript to submit the document via the browser's DOM. <form action='loginScript.cgi' method="post" name="loginForm">
2
2550
by: alan_atwood | last post by:
Hello all. I am having a problem with the submit() method that is driving me nuts. I'm using document.form.submit() with large text fields (approx. 2000 characters) and am getting a "Invalid Syntax" error. If I do the same thing with a text field of under 1500 characters, it works fine. Is there some size limit here that I don't know about? Haven't been able to find anything so far on this particular problem. Thanks,
5
71226
by: therjs | last post by:
i am trying to submit the form multipple times within a loop, if i have an alert() coded, it works, but, when i take the alert() out, it only does the submit the last time through the loop.
2
6492
by: Arif Bangash | last post by:
Hi All, I have a form like this <form id="frmworld" name ="frm" method=POST action "https://select.worldpay.com/wcc/purchase" > <input type="hidden" name="instId" value="135242"> <input type=hidden name="cartId" id ="cartId" value="" runat=server /> ............... ........... </form>
7
2734
by: vinsim24 | last post by:
Hi all, the code where i am finding a problem is as follows: <html> <head> <script> function fun1(){ window.document.formName.action="/someServlet"; window.document.formName.submit();
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10366
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...
1
10110
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
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.