Mailto Forms and Using Color
Total Page:16
File Type:pdf, Size:1020Kb
Mailto Forms and Using Color: Using The Mailto URL With Forms One of the more difficult aspects of forms is creating the server-side scripts that process the form data. This can be a daunting task for non-programmers and impossible for those webmasters who cannot create server-side scripts at all. Fortunately, all is not lost. It is possible to create forms and retrieve user-supplied data without writing or installing server-side processing scripts. The trick is to use the mailto URL to retrieve the form data. Normally, the mailto URL is used in a conventional link. When clicked by the user, the browser opens some sort of mail composition window, collects a message, and sends it to the address specified in the URL. When used as the action attribute of a form, the mailto URL instead mails the form data to the address in the URL. By setting this address to yourself, you can receive form data as conventional email messages. Before showing how all this works, keep in mind several caveats: · This does not work with Internet Explorer 3.0 · The data is sent to you in an encoded form (but can be converted, as I discuss below) · Conventional user feedback is not possible after the form is processed Given these warnings, let's go ahead and use this idea anyway! A Simple Example Here is a simple form, with a mailto URL as the form action: <form method=POST action="mailto:[email protected]" enctype="text/plain"> Name: <input type=text name="Name" size=40><br> Phone:<input type=text name="Phone" size=10 maxlength=10><br> Category:<input type=radio name="Category" value="Boats"> Boats <input type=radio name="Category" value="Cars"> Cars <input type=radio name="Category" value="Trucks"> Trucks <input type=radio name="Category" value="Planes"> Planes Description:<textarea name="Description" rows=6 cols=40></textarea> <input type=submit> </form> In case you are wondering, the resulting form looks like this: Name: Phone: Category: Boats Cars Trucks Planes Description: Submit Query Notice that this is a normal form, except that I used method=POST, enctype="text/plain", and set the action attribute to a mailto URL. Don't actually submit this form; you'll just send an empty message to my server. What You Get When a user submits the form, the form data is presented in a fairly readable format. For example, if I typed in my name and phone number, selected "Cars", and type a few lines of text into the text area in the form, the data that gets mailed to me looks like this: Name=Chuck Musciano Phone=123-4567 Category=Cars Description=this is a textarea tag As far as I can tell, if a browser doesn't support text/plain as the encoding, it will use the default encoding instead. This looks something like this: Name=Chuck+Musciano&Phone=123- 4567&Category=Cars&Description=This+is+a%0D%0Amulti-line%0D%0Ainput+field Bleah. At first, this seems totally useless. But a few simple substitutions and things will be looking much better. Just replace all the plus characters ("+") with spaces, and the ampersands ("&") with carriage returns: Name=Chuck Musciano Phone=123-4567 Category=Cars Description=This is a%0D%0Amulti-line%0D%0Ainput field The final conversion is to replace any %0D%0A sequences in your multiline input fields with line breaks. The bottom line: use enctype="text/plain" to make some, if not all, of your form results easier to read. Final Thoughts One drawback to the whole mailto form idea is that there is no way to give a user feedback that the form was correctly sent. Only use this trick when there is no other alternative. If you can make things work with a regular form CGI script, by all means, do it. Finally, remember that this only works with most browsers. Some older browsers may refuse to honor the mailto URL and not handle your form correctly. Using Hexadecimal Color Codes The Hexadecimal Color Codes are used for many things in HTML. For Page Backgrounds: <body bgcolor="#hexdec"> For Text Colors: <font color="#hexdec"> For Page-Wide Link and Text Colors: <body text="#hexdec" link="#hexdec" vlink="#hexdec" alink="#hexdec"> (where text is text color, link is non-visited link color, vlink is already-visited link color, and alink is the color a link turns at the second it is clicked) There are 16.7 million different colors in the hexadecimal color system. #000000 is black, and #FFFFFF is white. Each of the 6 digits in the hexadecimal code is broken into 3 seperate groups... · #XXxxxx - Red Color Value · #xxXXxx - Green Color Value · #xxxxXX - Blue Color Value Each digit is a value from 0 to F, in the hexadecimal system. The hexadecimal color system counts by 0 1 2 3 4 5 6 7 8 9 A B C D E F, with 0 being null value, and F being highest value. So if the first two digits (red values) are full (FF) and the other four are null (00) the color will be red. #FF0000 - AaBbCcDdEeFf1234567890 Background #FF0000 If the first two are null (00), the third and fourth digit (green value) are full (FF), and the fifth and sixth digit are null (00), the color will be green. #00FF00 - AaBbCcDdEeFf1234567890 Background #00FF00 If the first four digits are null (00), and the fifth and sixth digit (blue value) are full (FF), the color will be blue. #0000FF - AaBbCcDdEeFf1234567890 Background #0000FF Here is an example of the different shades of colors between black and white. #000000 - AaBbCcDdEeFf1234567890 Background #000000 #111111 - AaBbCcDdEeFf1234567890 Background #111111 #222222 - AaBbCcDdEeFf1234567890 Background #222222 #333333 - AaBbCcDdEeFf1234567890 Background #333333 #444444 - AaBbCcDdEeFf1234567890 Background #444444 #555555 - AaBbCcDdEeFf1234567890 Background #555555 #666666 - AaBbCcDdEeFf1234567890 Background #666666 #777777 - AaBbCcDdEeFf1234567890 Background #777777 #888888 - AaBbCcDdEeFf1234567890 Background #888888 #999999 - AaBbCcDdEeFf1234567890 Background #999999 #AAAAAA - AaBbCcDdEeFf1234567890 Background #AAAAAA #BBBBBB - AaBbCcDdEeFf1234567890 Background #BBBBBB #CCCCCC - AaBbCcDdEeFf1234567890 Background #CCCCCC #DDDDDD - AaBbCcDdEeFf1234567890 Background #DDDDDD #EEEEEE - AaBbCcDdEeFf1234567890 Background #EEEEEE #FFFFFF - AaBbCcDdEeFf1234567890 Background #FFFFFF Here are some examples of mixed colors... #FFFF00 - AaBbCcDdEeFf1234567890 Background #FFFF00 #00FFFF - AaBbCcDdEeFf1234567890 Background #00FFFF #FF00FF - AaBbCcDdEeFf1234567890 Background #FF00FF #ABCDEF - AaBbCcDdEeFf1234567890 Background #ABCDEF #FEDCBA - AaBbCcDdEeFf1234567890 Background #FEDCBA #A1F4BB - AaBbCcDdEeFf1234567890 Background #A1F4BB Try mixing your own colors in your web pages until you find one you like. .