View Full Version : Java Script Problem
harrythehound
01-06-2004, 11:12 AM
Can someone tell me why I get a Java Script Error pop-up from this when I try and use it:
<form method="POST" action="mailto:amanda@min-eng.com?subject=pyro05prog" enctype="text/plain" onSubmit="submitonce(this)">
<input type="text" name="email" size="25" value="your email address here" onFocus="clearText(this)">
<input type="submit" value="Send it!" onClick="open_new_window('thankyou.html');">
</form>
See it in action at http://www.min-eng.com/pyromet05/prog.html
Thanks,
Amanda
paulhiles
01-06-2004, 11:59 AM
Hi Amanda,
This is similar in a way to a recent post (http://www.webproworld.com/viewtopic.php?t=11196) from studionews.. although I think in your case the answer is more straightforward. The form is calling the following functions which are simply not found.
onSubmit="submitonce(this)"
onFocus="clearText(this)">
onClick="open_new_window('thankyou.html');">
This is why you're getting the JavaScript errors. Presumably, somewhere you have a JavaScript that needs to be inserted into the <head> of your document? Please let me know if I'm mistaken.
Paul
harrythehound
01-06-2004, 12:58 PM
Thanks Paul, I'm feeling a bit silly now! I copied the form from a different page and obviuosly forgot to copy the stuff from the header too. Doh!
paulhiles
01-06-2004, 01:16 PM
Thanks Paul, I'm feeling a bit silly now! I copied the form from a different page and obviously forgot to copy the stuff from the header too. Doh!Not to worry Amanda, I can see it's working fine now! I even signed up for the notification myself using "metallurgy at erimus dot com" However, you should remember that this method (mailto) is reliant on the user having an email client installed on their machine.
As redcircle pointed out (in a recent post (http://www.webproworld.com/viewtopic.php?p=58688#58688)) if your visitor is browsing from a library or another public institution, they may not be able to contact you via the form. So it does have its limitations... also I found that Mozilla Firebird actually prevented the redirect to your thankyou page.. even though IE went quite happily to it!
All part of life's rich pageantry! :o)
Paul
ronniethedodger
01-06-2004, 11:55 PM
As redcircle pointed out (in a recent post (http://www.webproworld.com/viewtopic.php?p=58688#58688)) if your visitor is browsing from a library or another public institution, they may not be able to contact you via the form. So it does have its limitations.
A way around that is to use Matt Wright's Form Mail script. It allows you to take information off of an Html Form and will email the results to your inbox. Client-side mail agent is not required. I use this script, and it works nicely.
I also noticed on here that there is now a service that will handle the server side of the script. So apparantly all you need is the form....no cgi involved and they handle the mail part of it. But it is not a free service.
http://www.scriptarchive.com/formmail.html
(postscript edit)
I guess that formmail was mentioned in the other post. Did not read it before posting this. Oh, well...the link is handy though! ;0)
paulhiles
01-07-2004, 01:40 AM
A way around that is to use Matt Wright's Form Mail script. It allows you to take information off of an Html Form and will email the results to your inbox. Client-side mail agent is not required. I use this script, and it works nicely.
I also noticed on here that there is now a service that will handle the server side of the script. So apparantly all you need is the form....no cgi involved and they handle the mail part of it. But it is not a free service.Totally agree Ron, the formmail.pl is probably the way to go... I wasn't aware of the paid service though. That's ideal for those folks who don't have the permissions to use server-side scripting.
Paul
ronniethedodger
01-07-2004, 03:45 AM
Yep, I just noticed the new service there today. It has been a couple of months since I was there last.
It is a little bit of a challenge to set up and understand some people. But well worth it to fumble through it.
I was lucky on my Host (FatCow) they have an installation script in my control panel. It basically has a form where you can define all your labels and ID's, then it builds a non-beautiful Html page and installs the script at the same time. All you have to do is tweak on the beauty part of the form. ;0)