Hello,
I wrote a small JavaScript program that takes a form submission and puts it into the subject line of an e-mail.
Each field must be separated to allow the receiving application to analyze the sent data correctly. For this purpose, I’m using a common horizontal tab (%09).
It seems to work, but I’m not really sure if it is a good idea to deal with a tab for this purpose.
Can I rely that a tab is always handled correctly in all mail apps or should I better use an other method ?
Please see the small script attached (put the entire code on a HTML page). Hints for improvements are also welcome, of course. Anyway, it is my goal to keep the script as simple as possible, because it needs to be managed by “non-techie” users.
Tobias.
Happy season’s greetings and a successful 2013 to all !
<script type='text/javascript'>
function ProcessMailForm(f)
{
var MailURL = "mailto:email@hidden?Subject=";
MailURL = MailURL + "|"; // Initiates extended profile contents. Don't touch it.
// Alter the following lines in accordance with the changes you apply to the form, but always (!) keep the %09 (tab char).
// If you wish to skip a field, use an instruction like this: MailURL = MailURL + "%09";
MailURL = MailURL + f.elements["Salutation"].value + "%09";
MailURL = MailURL + (f.elements["FirstName"].value) + "%09";
MailURL = MailURL + f.elements["LastName"].value + "%09";
MailURL = MailURL + f.elements["CustomField1"].value + "%09";
MailURL = MailURL + f.elements["CustomField2"].value + "%09";
MailURL = MailURL + f.elements["CustomField3"].value + "%09";
MailURL = MailURL + f.elements["CustomField4"].value + "%09";
MailURL = MailURL + f.elements["CustomField5"].value + "%09";
MailURL = MailURL + f.elements["CustomField6"].value + "%09";
window.location.assign(MailURL);
};
</script>
<form>
Salutation: <input name='Salutation' id='Salutation' type='text' size='5' maxlength='255'><br>
First name: <input name='FirstName' id='FirstName' type='text' size='30' maxlength='255'><br>
Last name: <input name='LastName' id='LastName' type='text' size='30' maxlength='255'><br><br>
Custom field 1: <input name='CustomField1' id='CustomField1' type='text' size='30' maxlength='255'><br>
Custom field 2: <input name='CustomField2' id='CustomField2' type='text' size='30' maxlength='255'><br>
Custom field 3: <input name='CustomField3' id='CustomField3' type='text' size='30' maxlength='255'><br>
Custom field 4: <input name='CustomField4' id='CustomField4' type='text' size='30' maxlength='255'><br>
Custom field 5: <input name='CustomField5' id='CustomField5' type='text' size='30' maxlength='255'><br>
Custom field 6: <input name='CustomField6' id='CustomField6' type='text' size='30' maxlength='255'><br><br>
<input type='button' value='Send subscription request' onclick='ProcessMailForm(this.form)'>
</form>
actionsdev mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options