2

votes

Vote

internet-networking in Internet & Networking Channel,
Written by: Arthur K. on Aug 26 2010, 6:12pm

mailto: form formatting

I can't believe I never bothered looking for this earlier, but better late than never, right?

 

When you use a simple mailto: command for forms, it will use the viewers default mail client to submit the form details. Depending on the users browser & settings, the submitted data will be sent in one of two ways.

Generally, in Internet Explorer, it will attach a file to the e-mail (postdata.att). You can then open that file with any text editing program, such as notepad or wordpad.

In firefox, it simply inserts the form data onto the body of the e-mail itself generally.

The only problem is, the formatting is not too user friendly.

This is how it looks when you open the postdata.att file in notepad as well as the body of the e-mail when used through FireFox:

 

Name=Arthur&Address=123+Street&City=Los+Angeles&State=California&Zip=99999&Country=United+States&Phone=0123456789&Email=test@test.com

 

As we can see, it's a bit difficult to read this.

Up until now, I had been using the replace all feature in notepad to replace the "&" character with either several spaces, or used commas and saved the file as a .csv file and opened it up in excel in a spreadsheet.

 

Now, with a SIMPLE line of code, the results will appears as the following in both browsers I tested in:

Name=Arthur
Address=123 Street
City=Los Angeles
State=California
Zip=99999
Country=United States
Phone=0123456789
Email=test@test.com

Doesn't that look A LOT better? :)

It also will be in the body of the e-mail in Internet Explorer, so you don't have to take that extra step of having to open the file in notepad.

 

And what is that simple line we need to ask you are all probably wondering?

enctype="text/plain"

 

Simply open the File Inspector in WebEasy and click on the form so that the entire form object is selected.

Then under the properties tab, locate the Attribute Custom Script.

Double click on the value to the right of it. This will open the Custom Script Assistant.

You should see a line of code already there that looks like:

onsubmit="return weCheckForm(this)"

Simply add a new line of text (Press CTRL + E) and type in

enctype="text/plain"

Viola!

 

 

 

Citizens Comments

Michael Bigelow says:

I find it easier to use the enctype attribute in the Inspector tool. To use the enctype attribute do the following

1) Select the form container

2) Open the properties tab (To open the inspector tool = ctrl + K)

3) Find the attribute labeled "Html Enctype"

4) Double click on the value box to the right

5) Select "text/plain" out of the drop down list

6) Click "OK" to apply the changes

3

Votes

Vote
Aug 29 2010, 9:34am | Report

Arthur K. says:

I agree, that is a lot easier LOL :)

1

Vote

Vote
Aug 30 2010, 8:52am | Report

Eileen Brown says:

Quick and easy Michael!  Great tip, good on you for passing it along to others.

:)

 

1

Vote

Vote
Jan 10 2011, 2:21pm | Report

Eileen Brown says:

OH BOY!  A good one to post into the FAQ's too.  :)

1

Vote

Vote
Jan 12 2011, 9:51am | Report

Michael Bigelow says:

Thanks Eileen!

1

Vote

Vote
Jan 12 2011, 3:25pm | Report

Post your comment

default Avatar

You might be interested in these related contributions

software social commerce