Go Back   CodingForums.com > :: Client side development > JavaScript programming > Post a JavaScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-12-2005, 06:48 AM   PM User | #1
pccode
New Coder

 
Join Date: Oct 2005
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
pccode is an unknown quantity at this point
Send and receive form data through email

The purpose of these scripts are to allow you to send forms using javascript. If your server doesn't support scripting languages like php or perl, or if you are unfamiliar with those languages, then this is an easy alternative for you.

When you send a form using the mailto: command, the data gets sent using the post method and in the process gets reformatted. When you receive the form data in your email it will contain hexadecimal characters, spaces will be replaced with + signs, and each value will be separated by an & sign.

You have two options when sending a form with javascript. Either you can reformat the data before it's sent. Thereby creating an email that is legible upon receiving it. Or you can reformat the data after you receive the email. I have posted both methods on this page.

Option 1: REFORMAT AFTER

Create your form using the following syntax:
Code:
<form name="NameOfYourForm" method="post" action="mailto:yourname@yourdomain.com">
<!-- your input tags go here -->
<input type="submit" value="Send">
</form>
Then download the attachment to this post. Open the file in your web browser. When you receive the email containing the form data, just select it all and copy it. Then paste the data into the "hexadecimal value" box. Click decode to convert it to ascii. Then click split to remove +'s and to split data onto multiple lines. Use the "add html" checkbox to make the output viewable in your web browser.

NOTE:
The first input tag that you use in your form will become the <title> if you use the html option. So if your first input tag is name="Name" value="Joe Smith" then the html title will appear as <title>Name: Joe Smith</title>.
Attached Files
File Type: zip hex2ascii.zip (1.4 KB, 1398 views)

Last edited by pccode; 10-13-2005 at 06:43 AM..
pccode is offline   Reply With Quote
Old 10-13-2005, 06:41 AM   PM User | #2
pccode
New Coder

 
Join Date: Oct 2005
Posts: 87
Thanks: 1
Thanked 0 Times in 0 Posts
pccode is an unknown quantity at this point
Option 2: REFORMAT BEFORE

Download the attachment in this post and open it in notepad. Edit the html file where you are prompted. You will then have the option of sending plain text emails or html emails. By using this script your form data will not need reformatting upon arrival.
Attached Files
File Type: zip javascriptform.zip (947 Bytes, 2474 views)
pccode is offline   Reply With Quote
Old 11-19-2006, 02:51 AM   PM User | #3
yaw_pakhton
New to the CF scene

 
Join Date: Nov 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
yaw_pakhton is an unknown quantity at this point
thanx alot man..

just wat i need..
yaw_pakhton is offline   Reply With Quote
Old 12-08-2006, 09:52 AM   PM User | #4
Mr. Bubble
Regular Coder

 
Join Date: Sep 2005
Posts: 146
Thanks: 0
Thanked 0 Times in 0 Posts
Mr. Bubble is an unknown quantity at this point
awesome! I'll definately be using this script. cheers buddy
Mr. Bubble is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:05 PM.


Advertisement
Log in to turn off these ads.