RobG wrote:
You have named your submit button "submit", so your reference above is
to the button, not the submit method of the form. Remove the button's
name or change it.
Thanks for the help Rob - you've managed to solve my problem. This was
the main problem, as you identified, which leaves me scratching my head
as to why it worked before or (more likely), when I made a change to
the code without even realising I had changed something.
I'm definitely not a JavaScript person - nor fancy HTML either. I'm
more of a PHP guy. I detest dreamweaver or most WYSIWYG programs since
their code is absolutely AWFUL. And doing everything by hand, it's a
pain in the arse to delve into complicated stuff like layers and such -
which half the time aren't necessary anyways. What happened to the days
when things were nice and simple?
bgcolor and background are both depreciated, use the equivalent style
properties, preferably in a css style element.
- as with the above, <body> would do fine for me until the day it is no
longer supported. I can't say i'm a fan of CSS and most of what I want
to develop doesn't need it.
<SCRIPT language="JavaScript" type="text/javascript">
The language attribute is depreciated, remove it. Keep the type
attribute, it is required.
I'll take your advice here. But is there any particular reason for
this? I notice most of the free JavaScripts include the opening tags
like this.
<!-- Hide script from old browsers
- They also (a lot of them) include a bit which ignores the script. Was
there any traditional reason for this before?
Subverting an A element this way is bad. -snip-
<a href="whyThisDidntWork.html" onclick="submitForm();" ...>...</a>
Oops. Actually what I used was:
<a href=\"javascript: void(0);\" onclick=\"submitForm();return
false;\">
But out of desperation when things didn't work I started playing around
with some changes, and must have used the wrong source code in my
posting.
Is javascript: void(0) acceptable? Or you would still suggest a real
link? Making the link without going running the function is as good as
not running it at all... so i'm not sure it would make a difference for
compatibility reasons.
The purpose of the link seems completely unnecessary. Why not call
submitForm() from the form's onsubmit event?
I need to run SubmitForm() becuase I want to add a hidden form variable
to the form before I submit it. The standard form submit button I have
(which would submit without this variable) achieves something else when
the resulting PHP page is loaded. Is there a better way to do this
though?
What I really need then is for two different ways to submit the form,
but one with an extra variable attached. Also I would prefer to use a
link since it looks nicer in my page.
Thanks again for your help.
Terence