Dear Dr. Website®: I have used mailto: action to send an order form to our e-mail. It worked when I tested it with IE 4.0 and Netscape Communicator on my computer. But when I tried the Netscape 4 Standalone version on another computer to test-submit an order from the Web page, we did not receive the form in our e-mail account, despite the fact Netscape did not tell me if it sent the form. Is it because the Standalone version doesn't have an e-mail function? If so, does this [no form is sent] happen to other browsers that are not configured to send e-mail?
The mailto: protocol is used to launch and set up an e-mail application, similar to the way the http: protocol is used to launch and set up a browser application. When the mailto: protocol was first initiated, all kinds of tricks were used to wrest control away from the browser for these links, so that people could use their favorite e-mail programs rather than the browser's internal e-mail (if any).
Now things are more civilized. MAPI (Mail Application Program Interface) lets your preferred e-mail application intercept mailto: URLs. Also, browsers tend to ask users what their preferred e-mail application is (in Microsoft Internet Explorer, see Tools/Internet Options/Programs; on Netscape, see Edit/Preferences/Mail & Newsgroups. You can check Netscape Messenger, or not).
This means that if someone is using a browser (such as Netscape Navigator Standalone) and doesn't have Netscape Messenger or any other MAPI-aware e-mail application configured, they won't be able to automatically launch their e-mail program when they click on your mailto:. That's why the only sure way to take orders via the Web is with a CGI program that mails the output of a form directly to you. There are dozens of Perl scripts that do this; several are available at ScriptSearch.
This can be seen with other protocols as well. For instance, the CuteFTP program can be minimized to the system tray and set up to intercept ftp: URLs pasted to the clipboard, so that you can download files using it rather than your browser.
Dear Dr. Website®: I have a group of forms with a submit button. When the user hits the submit button, I'd like three things to happen:
- Run the Perl script for the form data
- Use JavaScript to send an alert message
- Use JavaScript to close the window that contains the forms.
My guess as to how to do this is to put the usual ACTION attribute in the FORM tag and also include an ONSUBMIT to handle the alert and window closing. Correct?
You're correct, you can use more than one function when you submit the form:
<SCRIPT LANGUAGE="JavaScript">
function doit(){
alert('Welcome to our home page.');
document.myform.submit();
this.close()
}
</SCRIPT>
and in the form, instead of a standard submit button, you'd use:
<INPUT TYPE=BUTTON VALUE="Go" onClick=doit()>