[thelist] Submitting a form with javascript
Marek Kilimajer
kilimajer at webglobe.sk
Mon Nov 3 02:55:04 CST 2003
Give the form the same id and name.
John Corry wrote:
> I am at wit's end.
>
> I hardly ever work with JS, but am just trying to do something so simple
> it's funny:
>
> I want to submit a form when a user clicks a link.
>
> Why? So I can display the form submit mechanism outside the <form> tags.
>
> I made a function to do the submission:
> <script language="javascript" type="text/javascript">
> function updateIt()
> {
> window.document.updateForm.submit()
> return true
> } // end function
> </script>
>
> And I have a form:
> <form action="/admin/update_form.php" method="post" name="update"
> id="updateForm">
>
> And I have a link:
> <a href="#" onClick="updateIt();">
>
> 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! Why won't it work for me? Yes, I have
> javascript on.
>
> /me is so frustrated he can hardly stand it...
>
> Thanks if you can help me see the stupidity I'm missing,
>
> John Corry
>
>
>
More information about the thelist
mailing list