Can anyone tell me why (contradicting what other people say) I can't change the URL in the onSubmit handler? Here's what I'm doing:
<FORM NAME="test" METHOD="POST">
<INPUT TYPE="submit" NAME="btn" VALUE="Click me"
According to everything I've read, this should work. In fact, it works if I change it to a button (TYPE="button") and use the onClick handler (onClick=...)!
I am testing it in Netscape 4.5, by the way.
I reckon you've been misled. AFAIK, onSubmit is only valid in the <FORM> tag, and will only work if you use a submit input field. So you can either use:
<input type="submit" value="Submit">
<form action="whatever" name="test" method="POST">
Thanks enormously, Adam. I'll try your suggestions and see how it goes.
P.S. One of my friends used to call me "Grahamster the hamster." Your nick brought that back to me!
Well, I tried what you suggested, and. . .
What DOES seem to work is changing the Submit button to a normal button, and in the onClick handler calling document.form.submit(). What a goofy situation.
This is really annoying. IE 4.01 will pop up the message box about a security risk (something about sending an unencrypted e-mail), but NOT send anything!
Netscape just doesn't send anything.
BOTH browsers will change the location correctly!!!! I am I going insane?
Here's my test form:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.6 [en] (Win95; I) [Netscape]">
<FORM ACTION="mailto:email@example.com" ENCTYPE="text/plain"
<INPUT TYPE="text" NAME="Nothing" VALUE="Help!" SIZE="20" MAXLENGTH="0">
<INPUT TYPE="button" NAME="btn" VALUE="Click me"
July 14th, 1999, 02:59 AM
Hmmm. I just found out that form.post() does NOT WORK when using the mailto: method!
Actually, IE tried to send the e-mail, but didn't complete, since Netscape Messenger put the e-mails into my "Drafts" folder.
That means I'll have to find some way to change the page in the onSubmit event.