Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-26-2004, 04:07 AM   PM User | #1
Quiz
New Coder

 
Join Date: Nov 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Quiz is an unknown quantity at this point
submit() - object does not support

When using the submit() method on a form I am getting an "Object does not support this method" error. The form does post itself so it recognizes the command.

I have tried many ways of identifying the form but I still get the same error.

I would appreciate any advice. Thanks.
Quiz is offline   Reply With Quote
Old 10-26-2004, 04:26 AM   PM User | #2
hemebond
Senior Coder

 
Join Date: Jul 2004
Location: New Zealand
Posts: 1,315
Thanks: 0
Thanked 2 Times in 2 Posts
hemebond is an unknown quantity at this point
I would appreciate any code. Thanks.
hemebond is offline   Reply With Quote
Old 10-26-2004, 09:30 AM   PM User | #3
Quiz
New Coder

 
Join Date: Nov 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Quiz is an unknown quantity at this point
Ok, I believe the following two statements are the only ones involved and that they are isolated.. in JS and html.

Code:
// This is called at the end of a function

document.getElementById('contactform').submit();

<!-- ...and the form tag -->

<form action="process.php" id="contactform" method="POST">

I get: "Object does not support this property or method" Code 0

I would like to use a plain button or image link to send the form (not a submit button). I should correct that the form only submits if I use a submit button which actually means the submit() method does not work at all.

Which brings me to ask if there are any good Javascript debugging/helper programs or plugins. I have tried JSLint and the IE but they both have their limits of usefullness.

Thanks.
Quiz is offline   Reply With Quote
Old 10-26-2004, 07:17 PM   PM User | #4
adios
Senior Coder

 
Join Date: Jun 2002
Posts: 1,404
Thanks: 2
Thanked 32 Times in 32 Posts
adios is on a distinguished road
Try changing the name of your submit button to "Walter". I am not kidding.
adios is offline   Reply With Quote
Old 10-26-2004, 07:28 PM   PM User | #5
requestcode
Regular Coder

 
Join Date: Jun 2002
Posts: 626
Thanks: 0
Thanked 0 Times in 0 Posts
requestcode is an unknown quantity at this point
What they are trying to tell you is that you are not providing enough information for them to help you. Perhaps you could provide a link to the page or post all of your code here. Also, try running it in one of the Mozzila browsers and then check the Javascript Console under Tools to see what the errors are. They will give you more descriptive messages then IE does.
requestcode is offline   Reply With Quote
Old 10-26-2004, 07:28 PM   PM User | #6
adios
Senior Coder

 
Join Date: Jun 2002
Posts: 1,404
Thanks: 2
Thanked 32 Times in 32 Posts
adios is on a distinguished road
Try changing the name of your submit button to "Walter". I am not kidding.
adios is offline   Reply With Quote
Old 10-26-2004, 10:13 PM   PM User | #7
hemebond
Senior Coder

 
Join Date: Jul 2004
Location: New Zealand
Posts: 1,315
Thanks: 0
Thanked 2 Times in 2 Posts
hemebond is an unknown quantity at this point
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
	<head>
		<title>46621</title>
	</head>
	<body>
		<form action="reciever" method="get">
			<input name="text" type="text" value="success">
		</form>
	</body>
	<script type="text/javascript">
		document.getElementsByTagName("form")[0].submit();
	</script>
</html>
hemebond is offline   Reply With Quote
Old 10-27-2004, 12:19 AM   PM User | #8
Quiz
New Coder

 
Join Date: Nov 2003
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Quiz is an unknown quantity at this point
Ok. Mozilla gives me pretty much the same error. Function not supported. I have not figured out how to use Venkman yet.


Here is the full page stripped down to the problem (even with the walter(?) and TagName methods):


Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>Untitled</title>
<script language="JavaScript" type="text/javascript">

function submitForm(){
document.getElementsByTagName('form')[0].submit();
//document.getElementById('walter').submit();
} 

</script></head><body>

<form action="lookup.php" id="walter" method="POST">
<input type="text" id="firstname" name="firstname" />
<button onclick="submitForm();" id="submit" class="buttonForm" value="">Send</button>
</form>

</body></html>
Quiz is offline   Reply With Quote
Old 10-27-2004, 04:53 AM   PM User | #9
adios
Senior Coder

 
Join Date: Jun 2002
Posts: 1,404
Thanks: 2
Thanked 32 Times in 32 Posts
adios is on a distinguished road
You forgot to Capitalize 'Walter' ! You forgot to Capitalize 'Walter' ! Aaaaarrrggghhh......

OK, sorry, but every time I see this one, it makes me lol. The only possible way the Form.submit() method could be 'not support[ed]' is if you've over-written it. Like so:

<input type="submit" name="submit" />

Form.submit now contains a reference - to a button. Not much point in calling that. I have no idea how browser manufacturers let this one slip by, it's such an obvious pitfall. Join the club.

Submitting a form the usual way - submit button, image, hitting <enter> in a textfield, doesn't call Form.submit(), which (I assume) is just a JS wrapper. That's why they still, erm, function.

Just ignore all the other silly advice - except that 'Walter' business of course - and go back to what you had, with a new name. Walter.
adios is offline   Reply With Quote
Old 08-22-2008, 03:27 AM   PM User | #10
Mijii
New to the CF scene

 
Join Date: Aug 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Mijii is an unknown quantity at this point
LOL, adios - you are a complete ***.. but classic at the same time.. yer changed it to 'Walter' and yep, it worked...

Something to keep an eye out for next time.. LOL...
Mijii is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:31 PM.


Advertisement
Log in to turn off these ads.