Pieman wrote:
> Hi Trevor,
>
> That would be great if you can post the code it would help me out big
> time...
>
> Cheers
> Si
Hi Si,
No problem at all
Paste this in the <head> section.
<script type="text/javascript">
function testform()
{
// place code in here to validate the form
}
function sendform()
{
with (document.form1)
{
var body = ''
var i = elements.length , j = 0
while (i-- > 2) // drop last two elements
{
body += elements[j].name
body += elements[j].value + '%0d%0a' // line break after each
line
j += 1
} // end while
}
window.location = "mailto:" + "me" + "@" + "mysite" + ".com"
+ "?subject=Response%20from%20Form1"
+ "&body=" + body
}
</script>
Paste this in the <body> section
<form name="form1" action="">
<b>Title for Form1</b>
<!-- enter your form fields in here -->
<!-- make these the last two fields -->
<input type="button" id="submit" value=" Send " onmouseover="testform()"
onclick="sendform()" />
<input type="reset" id="reset" value=" Clear "/>
</form>
By using onmouseover="testform()", you call the validate code before sending
the form.
I code testform() with statements like
if (errorcondition) return
So you will only exit the function when all errors have been tested and
cleared.
At that stage, you can press the buton to send the form
Works for me :-))
--
Cheers,
Trevor L.
Website:
http://tandcl.homemail.com.au