james3302
August 1st, 2007, 03:57 PM
<SCRIPT TYPE="text/javascript">
function doClear()
{
document.text_form.city.value = "";
}
-->
</script>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>CAD/E Webview Server - CSA Maps</title>
</head>
<body>
<h1>CAD/E SE Market - CSA Maps</h1>
<hr>
<h4>
If you want maps of South GA then just request them below
</h4>
<form action="MAILTO:email@comain.com" onsubmit="doClear()"
method="post" enctype="text/plain">
City Name:
<input type="text" name="city" >
<input type=Submit value="Send">
</form>
</body>
</html>
MrViggy
August 1st, 2007, 06:34 PM
What is the problem/question?
Viggy
james3302
August 1st, 2007, 10:37 PM
I am wanting t user to enter a city name into the textbox and click send. It will emailed to me. Then I want the textbox to be cleared out after the user clicks send. If possible I also would like to know how to set the subject line, I used to know how in college.
SuperKoko
August 4th, 2007, 02:11 PM
Try that:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<title>CAD/E Webview Server - CSA Maps</title>
<script type="text/javascript">
<!--
function doClear()
{
// document.getElementById("city-input").value = "";
}
-->
</script>
<style type="text/css">
<!--
p.introduction {
font-size: 1.5em;
}
-->
</style>
<body>
<h1>CAD/E SE Market - CSA Maps</h1>
<hr>
<p class=introduction>
If you want maps of South GA then just request them below
<p> This form should open your default e-mail user agent, ready to send a message to email@comain.com, with a subject line set to "Request" (without the quotes) and a message body with the city name as first line. If your e-mail user agent doesn't set the subject or body to these values, please enter them manually.
<p> This e-mail message should look like:
<pre>
From: yourAddress@yourDomain.com
To: email@comain.com
Subject: Request
The city name
--
Your signature (optional)
</pre>
<form action="mailto:email@comain.com" onsubmit="doClear()"
method=GET>
<p>
<input type=hidden name=subject value=Request>
<label for=city-input accesskey=c>City Name: </label>
<input id=city-input type=text name=body>
<input type=submit value=Send>
<input type=reset value="Reset city field">
</form>
</body>
</html>
Parameters to the mailto protocol are not well supported by all user agents.
Consequently, you cannot rely on them being available everywhere.
Moreover, Opera 8.54 doesn't pass the extra parameters, probably because it assumes that the GET method doesn't apply to the mailto protocol (it's an HTTP method).
I don't see why you want to clear the input field. Usually, people want to preserve their form data as far as possible.
Anyway, there's an issue: onsubmit is invoked before the form is submitted and the form is not submitted before the script returns.
There may be hacks... For example, using an input whose name=city, and, onsubmit, copy the value to an hidden input whose name=body and clear the field whose name=city, but that wouldn't work with JavaScripts turned off.
Reference:
http://support.microsoft.com/kb/q188019/
http://support.microsoft.com/kb/279460