473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

document.form.submit()

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
called "submit", everything submits fine....
please help,
Chris.
Jul 20 '05 #1
14 14096
Chris wrote on 16 dec 2003 in comp.lang.javascript:
<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
called "submit", everything submits fine....
document.forms.buysell.submit()

I would put the target declaration in the <form >
and use no <a> at all:

<img
onclick="document.forms.buysell.submit()"
onMouseOver="..."
onMouseOut="..."
src="images/members.gif"
alt="Back to members page"
name="members" id="members"
width="270" height="25"


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
In article <c2**************************@posting.google.com >,
ch****************@hotmail.com enlightened us with...
Heres my problem:

<a href="javascript:void(document.buysell.submit())"
First of all, void is just that - void. No params.
If you MUST use this because you have to support old browsers, use
<a href="javascript:document.forms["buysell"].submit();

If you support only newer browsers, do this the right way.
<a href="#" onClick="document.forms['buysell'].submit;return false;"

Keep in mind about 5% of US users in general (last I read on some IT
site, anyway) do not have JS enabled browsers. For them, this will not
submit any form at all. You should really have something in that href
for people with no JS if this is for an internet site.
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
called "submit", everything submits fine....

I notice you reference "parent" as the target. Is the form on the same
page as this script? If not, you should reference it as
top.frames["framename"].document.forms["formname"]
to be sure the script can "see" it.

--
--
~kaeli~
Murphy's Law #2000: If enough data is collected, anything
may be proven by statistical methods.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #3
Chris wrote:
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
called "submit", everything submits fine....
please help,
Chris.


If you want something that looks like a link to submit a form, I
recommend:

<style type="text/css">
..submitLink {
background-color: transparent;
padding: 8px;
border: 0px solid transparent;
color: Blue;
text-decoration: underline;
cursor: pointer;
cursor: hand;
}
..submitLink:active {
border: 0px solid transparent;
color: Red;
}
}
</style>
<form>
<input type="submit" name="submitBtn" value="Order" class="submitLink" />

</form>

Certainly it isn't as pretty in Netscape 4 or Opera 6, but it's
guaranteed to give you a usable submit button regardless of the browser
being used (presuming the browser supports form and form submission).

By the way, Opera 7.23 is *still* having problems with this design. With
7.23, it now honors border requests on buttons, but it honors neither the
cursor: nor the text-decoration: directives. Also, Opera 7.23 seems to
support the :active pseudo-class, at least partially, it makes a valiant
attempt to honor the border: directive, but it fails to do it correctly.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #4
Grant Wagner wrote:
padding: 8px;


Remove this, I was just seeing if padding made a difference to Opera showing
text-decoration: and left it in when I posted.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
* http://devedge.netscape.com/library/...ce/frames.html
* Internet Explorer DOM Reference available at:
* http://msdn.microsoft.com/workshop/a...ence_entry.asp
* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #5
@SM
Grant Wagner a ecrit :

If you want something that looks like a link to submit a form, I
recommend:

<style type="text/css">
.submitLink {
background-color: transparent;
padding: 8px;
border: 0px solid transparent;
color: Blue;
text-decoration: underline;
cursor: pointer;
cursor: hand;
}
.submitLink:active {
border: 0px solid transparent;
color: Red;
}
}
</style>
<form>
<input type="submit" name="submitBtn" value="Order" class="submitLink" />

</form>

Certainly it isn't as pretty in Netscape 4
over all in NN4
who don't know "transparent" and display a black color ! ! !
By chance (or lucky) NN4 don't accept css on a button.

so use :

..submitLink {
padding: 8px;
border: 0;
color: blue;
text-decoration: underline;
cursor: pointer;
cursor: hand;
}
..submitLink:active {
/* border is the same and herited from above */
color: Red;
}

guaranteed to give you a usable submit button regardless of the browser
being used (presuming the browser supports form and form submission).


-- ----
@SM
move away *OTEZ-MOI* from my reply url
Jul 20 '05 #6
@SM
Chris a ecrit :

Heres my problem:

<a href="javascript:void(document.buysell.submit())" target="_parent"


<a href="javascript:void()" target="_parent"

or

<a href="document.forms['buysell'].submit" target="_parent"
onclick="return false;">

I hope you want to replace the framed page displayed in
main window ?

Anyway, with these 3 codes anything will happen...
(except on 2nd if JS is disabled)

to get something :

<a href="#" target="_parent"
onclick="document.forms['buysell'].target='frame2';
document.forms['buysell'].submit(); return false;">
-- -----
@SM
move away *OTEZ-MOI* from my reply url
Jul 20 '05 #7
still doesnt work, but thanks for feedback anyway.
Jul 20 '05 #8
kaeli <ti******@NOSPAM.comcast.net> wrote in message news:<MP************************@nntp.lucent.com>. ..
In article <c2**************************@posting.google.com >,
ch****************@hotmail.com enlightened us with...
Heres my problem:

<a href="javascript:void(document.buysell.submit())"


First of all, void is just that - void. No params.
If you MUST use this because you have to support old browsers, use
<a href="javascript:document.forms["buysell"].submit();

If you support only newer browsers, do this the right way.
<a href="#" onClick="document.forms['buysell'].submit;return false;"

Keep in mind about 5% of US users in general (last I read on some IT
site, anyway) do not have JS enabled browsers. For them, this will not
submit any form at all. You should really have something in that href
for people with no JS if this is for an internet site.
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
called "submit", everything submits fine....

I notice you reference "parent" as the target. Is the form on the same
page as this script? If not, you should reference it as
top.frames["framename"].document.forms["formname"]
to be sure the script can "see" it.

--

ok so the form submits, well not really because its not updating data
so really the form is just refreshing... any ideas?
Jul 20 '05 #9
In article <c2**************************@posting.google.com >,
ch****************@hotmail.com enlightened us with...


ok so the form submits, well not really because its not updating data
so really the form is just refreshing... any ideas?


Then how do you know it isn't a problem on the server side?

The default action for a form is to submit to itself. Do you have an
action defined?

--
--
~kaeli~
Do cemetery workers prefer the graveyard shift?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #10
"@SM" wrote:
Grant Wagner a ecrit :

If you want something that looks like a link to submit a form, I
recommend:

<style type="text/css">
.submitLink {
background-color: transparent;
padding: 8px;
border: 0px solid transparent;
color: Blue;
text-decoration: underline;
cursor: pointer;
cursor: hand;
}
.submitLink:active {
border: 0px solid transparent;
color: Red;
}
}
</style>
<form>
<input type="submit" name="submitBtn" value="Order" class="submitLink" />

</form>

Certainly it isn't as pretty in Netscape 4
over all in NN4
who don't know "transparent" and display a black color ! ! !
By chance (or lucky) NN4 don't accept css on a button.


In Netscape 4.78, I get a standard grey button with underlined text. Netscape
4.x certainly does honor a number of CSS attributes on <input> elements, and
does it consistently (although some of the behaviour is certainly not what you
would expect, it is consistent between Netscape 4.6x/4.7x clients, at least in
my experience).
so use :

.submitLink {
padding: 8px;
Remove this, it was part of testing to see if some aspect of the button was
preventing "text-decoration: underline;" from working properly in Opera 7.23.
border: 0;
color: blue;
text-decoration: underline;
cursor: pointer;
cursor: hand;
}
"border: 0;" doesn't properly suppress the border in Opera 7.23. In fact,
neither does "border: none;", which is why I went with "border: 0px solid
transparent;". Which specific version of Netscape 4.x doesn't render this
correctly? I'd like to install it and use it for testing.
.submitLink:active {
/* border is the same and herited from above */
Yes, it was included inadvertently from testing I was doing trying to suppress
the border in Opera 7.23 when the button is pressed, it should have been
removed in the final version.
color: Red;
}


You know, considering how "standards compliant" Opera claims to be, it
certainly doesn't deal with some of these CSS issues even as adeptly as IE.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #11
@SM
Grant Wagner a ecrit :

Some very interesting things.

I wanted only to precise :

My NN is NC 4.5 (on old Mac system 8.6)
so, I can't see what you say.

Opera I can use is 6,03 (not more)
it is an horror !

IE is 5.0 (a fiew better and badder than same on PC)
Jul 20 '05 #12
kaeli <ti******@NOSPAM.comcast.net> wrote in message news:<MP************************@nntp.lucent.com>. ..
In article <c2**************************@posting.google.com >,
ch****************@hotmail.com enlightened us with...


ok so the form submits, well not really because its not updating data
so really the form is just refreshing... any ideas?


Then how do you know it isn't a problem on the server side?

The default action for a form is to submit to itself. Do you have an
action defined?

--


because i am doing the server side code...
the form submits data fine when clicking the submit button...
I got document.forms['formname'].submit() to work for the form, but on
other forms it does not because there target is not "_parent" ...
Jul 20 '05 #13
In article <c2*************************@posting.google.com> ,
ch****************@hotmail.com enlightened us with...

because i am doing the server side code...
the form submits data fine when clicking the submit button...
I got document.forms['formname'].submit() to work for the form, but on
other forms it does not because there target is not "_parent" ...


So specify the target in the form, not the javascript.

--
--
~kaeli~
Why did kamikaze pilots wear helmets?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 20 '05 #14
kaeli wrote:
In article <c2**************************@posting.google.com >,
ch****************@hotmail.com enlightened us with...
Heres my problem:

<a href="javascript:void(document.buysell.submit())"
First of all, void is just that - void. No params.


This is utter nonsense. It is the `void' special unary operator.
Its operand may be a paranthesed expression.
If you MUST use this because you have to support old browsers, use
<a href="javascript:document.forms["buysell"].submit();


Using the `void' operator is correct here since the `submit()' method
could return a value which replaces then the current document. *Not*
using it is bordering to incorrect here, considering the intended use
of the `javascript:' URI scheme: To use the return value of an
expression as contents of a temporary HTML document.

http://devedge.netscape.com/library/...r.html#1012081
PointedEars
--
My proposal is not a solution for the actual problem.
(Markus Ernst in cljs, <br*******************@news.demon.co.uk>)
Jul 20 '05 #15

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

Similar topics

3
by: Varun | last post by:
Hi There, I have a form("myRequest.asp") and the values from it are retrieved into the page ("output_Print.asp") on which I have two buttons('Save As Complete' and 'Save As Incomplete'). When the...
2
by: Miles Davenport | last post by:
My Javascript is rather rusty :( ... and I need to do change some form values, in the folowing way: (1). I have the following a href (wrapped in PHP), which calls processForm. ==== <input...
4
by: jiing.deng | last post by:
I want to transfer a value "re1" to ldapDeleteUserExec.php The "alert(document.ha)" appears a dialog and shows "undefined." The "alert(document)" shows "object" But there seems some problem:...
5
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...
3
by: davidkarlsson74 | last post by:
Error: document.getElementById("folderMenu").cells has no properties File: http://www.volkswagen.se/tillbehor/js/foldermenu.js Rad: 49 The function activates different DIV:s, but doesn't seem to...
8
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)
5
by: antonyliu2002 | last post by:
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...
2
by: ChrisLA | last post by:
Hi; I've seen lots of discussion & disagreement on this issue, so any good explanation would be appreciated. Some people seem to think that "document.GetElementByID("MyName").submit(); should...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...

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.