[thelist] Submitting a form with javascript

John Corry lists at neoncowboy.com
Sun Nov 2 21:52:26 CST 2003


Accessibility is not an issue in the long term...and even if it were, right
now I'm just trying to make the form submit.

	<script language="javascript" type="text/javascript">
	function updateit()
	{
		document.forms['updateform'].submit()
	} // end function
	</script>

Yields:
Error: document.forms.updateform.submit is not a function
Source File: http://nishiyama.localhost.com/admin/update_form.html#
Line: 17

The form tag reads:
<form action="/admin/update_form.php" method="post" name="updateform"> 


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Tom Dell'Aringa
Sent: Sunday, November 02, 2003 5:39 PM
To: thelist at lists.evolt.org


--- John Corry <lists at neoncowboy.com> wrote:
> I am at wit's end.

> And when I click the link, the mozilla javascript console tells me:
> Error: window.document.updateForm.submit is not a function Source 
> File: http://nishiyama.localhost.com/admin/update_form.php#
> Line: 18
> 
> WTF!?
> Submit() is not a method of a form object?
> Window.document.updateForm is not a form object?
> 
> What is going on? I went through 10 stupid javascript tutorials and 
> this is how ALL OF THEM referenced the form!

John,

Here is your problem:

<form action="/admin/update_form.php" method="post" name="update"
id="updateForm">

the NAME of your form is "update" NOT updateForm. You do NOT reference the
ID, but the NAME attribute.

Do this:

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

You don't need the window reference. Also, make use of the DOM level 0 forms
array, its good form. As for your HREF, it is not accessible.
Read .jeffs "Forms and JavaScript living in Harmony" (paraphrasing
title) to learn how to use an HREF correctly with JS. Its in the articles
section of evolt.org

HTH

Tom


=====
http://www.pixelmech.com/ :: Web Development Services
http://www.DMXzone.com/ :: JavaScript Author / Every Friday!
http://www.thywordistruth.net/ :: Eternal Life

"I'll ho ho and ha ha you!" (Daffy Duck)
--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives
of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 




More information about the thelist mailing list