Sunday, February 13, 2005

Submit Button On A Form

The following question was asked recently on one of the lists that I subscribe to and I found in very interesting. If you have any comments I would love to hear them.

Question: Does anyone know how to properly set the "Submit" button on a form to launch an email program or to send an email?

Answer: Launching the email program or sending the email actually has nothing to do with the subimt button. You need to set an "action" on the form itself. In Dreamweaver, select the form, then in the property inspector, you will see a box labeled action.

If you want to send it as an email, you can simply type mailto: and the email address. However, this is far from ideal, as it actually works just like a mailto: on a hyperlink. When the user clicks the submit button, the browser will launch the users default email program (Outlook or whatever they have on their machine) with a new message addressed to whatever you put after mailto. They will then have to send the message themselves.

A far better way is to use a server-side script to send the message. There are lots of scripts available for free on the net that you can use. First, check with your webhost and see if they have one already set up on the server - a lot of them provide that as a service now. If they don't, find out what scripting languages they support. Most likely, it will be Perl, PHP, ASP, ASP.NET, and/or ColdFusion. If they support Perl, go to www.scriptarchive and download Formmail. It comes with all of the necessary instructions to set it up and use it.

If they support PHP, ASP, or ColdFusion, you can go to and download their Kaos Mailer extension for Dreamweaver, which gives you a nice dialog-box interface to fill out. However, this requires a bit more set up on your DW site, so if you decide to use this, post another message and I can fill you in on the details of using it.

Once you have whichever script you want installed, you will simply provide the path to the script in the action box on the Property Inspector for the form. This way, when your user clicks submit, the email will be sent to you with no further user interaction.


Post a Comment

<< Home