Submit Form with Results to Email

K

KML

Is there a way to have the actual form with the results send via email? I've
FrontPage 2003 and I can send the form results to an email. I want to go an
extra step by sending the whole form with the results. FP's Form Properties
has the Send to Other option using Custom ISAPI, NSAPI, CGI or ASP script,
which I read can do this. Does anyone has example of these scripts and some
instructions or could direct me to websites that have information to do this?
Thanks!
 
T

Trevor L.

KML said:
Is there a way to have the actual form with the results send via
email? I've FrontPage 2003 and I can send the form results to an
email. I want to go an extra step by sending the whole form with the
results. FP's Form Properties has the Send to Other option using
Custom ISAPI, NSAPI, CGI or ASP script, which I read can do this.
Does anyone has example of these scripts and some instructions or
could direct me to websites that have information to do this? Thanks!

Here is a form which submits an email to several addresses. I wrote it in
reply to another query so modify it as you want.
Unfortunately it won't format the email to look like the form but it does
retain all the fields and their values.

The important bits to keep are
<form name="form1" action="">
and
<div align="center" style="background-color:#DBE0F5; padding:3px;
font:12px arial;">
<input type="button" id="submit" value=" Send "
onmouseover="testform()" onclick="sendform()" />
<input type="reset" id="reset" value=" Clear "/>
</div>
(This <div> needs to be last because the script deletes it from the email,
but the style can be what you like.)

Also keep the functions
testform()
sendform()
although you can modify these to do what you want

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<!-- formtest.html -->

<head>
<title>Form Test</title>
<meta name="Author" content="Trevor Lawrence"/>
<meta http-equiv="Content-Language" content="en-au"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<!-- Internal JS -->
<script type="text/javascript">
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one line...
if
(field.value.match(/(^(\S+@)\S+(((\.ac)|(\.aero)|(\.arpa)|(\.biz)|(\.co)|(\.com)|(\.coop)|(\.edu)|(\.firm)|(\.gov)|(\.info)|(\.int)|(\.jobs)|(\.mil)|(\.museum)|(\.name)|(\.nom)|(\.net)|(\.org)|(\.pro)|(\.store)|(\.travel)|(\.web))(\.\S{2})?)$)/i))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
// --------------------
function testform()
{
with (document.form1)
{
for (var i = 1; i <= 4 ; i++)
if (!checkEmailAddress(elements['Email' + i]))
return
var yesreply = yes.checked
var noreply = no.checked
if (yesreply == noreply)
{ alert ('Reply must be Yes or No')
return }
else
Joining.value = yesreply ? 'Yes' : 'No'
}
}
// --------------------
function sendform()
{
var recpt = ''
for (var i = 1; i <= 4 ; i++)
{
recpt += document.form1.elements['Email' + i].value
if (i < 4 )
recpt += ';'
}
with (document.form1)
{
var body = ''
var i = elements.length , j = 0
while (i-- > 2) // drop last two elements
{
var tname = elements[j].id
var text = (elements[j].checked) ? 'Yes' : elements[j].value
if (text != 'on' && tname != 'yes' && tname != 'no' &&
!tname.match(/(^Email)/))
{
body += tname + ": "
if (tname == "Comment")
body += '%0d%0a' // line break before comment text
body += text + '%0d%0a' // line break after each line
}
j += 1
} // end while
}
window.location = "mailto:" + recpt
+ "?subject=Response%20from%20Form1"
+ "&body=" + body
}
</script>
</head>
<body onload="">
<noscript>
This site requires Javascript enabled<br />
</noscript>
<div id="maindiv" align="center">
<div style="border:1px solid #999999; width:60%;
background-color:#F2F4FA;">
<form name="form1" action="">
<div style="background-color:#DBE0F5; padding:3px; font:75% arial;">
<b>Title</b>
</div>
<div style="padding:10px; font:75% Arial; text-align:left;">
<p>
Hi all,<br />
</p>
<p>
Email1:<br/>
<input type="text" id="Email1" value="Insert e-mail address" size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Email2:<br/>
<input type="text" id="Email2" value="Insert e-mail address" size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Email3:<br/>
<input type="text" id="Email3" value="Insert e-mail address" size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Email4:<br/>
<input type="text" id="Email4" value="Insert e-mail address" size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Do you want to join? <br/>
<input type="checkbox" id="yes" />Yes <br/>
<input type="checkbox" id="no" />No <br/>
<input type="hidden" id="Joining" size="3" />
</p>
Enter Comment:<br/>
<textarea id="Comment" rows="10" cols="100"
style="font:100% Arial;">Enter your comment in
here</textarea><br />
</div>
<div align="center" style="background-color:#DBE0F5; padding:3px;
font:12px arial;">
<input type="button" id="submit" value=" Send "
onmouseover="testform()" onclick="sendform()" />
<input type="reset" id="reset" value=" Clear "/>
</div>
</form>
</div>
</div>
</body>
</html>
 
S

Stefan B Rusynko

Not possible w/ the FP forms handler
- Requires server side scripting
(depending in your host OS and what they support)

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| Is there a way to have the actual form with the results send via email? I've
| FrontPage 2003 and I can send the form results to an email. I want to go an
| extra step by sending the whole form with the results. FP's Form Properties
| has the Send to Other option using Custom ISAPI, NSAPI, CGI or ASP script,
| which I read can do this. Does anyone has example of these scripts and some
| instructions or could direct me to websites that have information to do this?
| Thanks!
 
A

Andrew Murray

If by the "whole form" you mean the actual fields and buttons, no; it only
sends the data as text.
 
A

Andrew Murray

"Send to other" merely allows you to use an ASP or CGI script to process the
email, rather than use the server extensions to do so.

Trevor I don't know if your answer is relevant to what the OP is asking.

???


From what I can see, the OP wants a script to send an email with the actual
fields (i.e. the text area, the textbox, the radio buttons etc with the
email so it shows up in his email as the user views it when submitting it.


Trevor L. said:
KML said:
Is there a way to have the actual form with the results send via
email? I've FrontPage 2003 and I can send the form results to an
email. I want to go an extra step by sending the whole form with the
results. FP's Form Properties has the Send to Other option using
Custom ISAPI, NSAPI, CGI or ASP script, which I read can do this.
Does anyone has example of these scripts and some instructions or
could direct me to websites that have information to do this? Thanks!

Here is a form which submits an email to several addresses. I wrote it in
reply to another query so modify it as you want.
Unfortunately it won't format the email to look like the form but it does
retain all the fields and their values.

The important bits to keep are
<form name="form1" action="">
and
<div align="center" style="background-color:#DBE0F5; padding:3px;
font:12px arial;">
<input type="button" id="submit" value=" Send "
onmouseover="testform()" onclick="sendform()" />
<input type="reset" id="reset" value=" Clear "/>
</div>
(This <div> needs to be last because the script deletes it from the email,
but the style can be what you like.)

Also keep the functions
testform()
sendform()
although you can modify these to do what you want

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<!-- formtest.html -->

<head>
<title>Form Test</title>
<meta name="Author" content="Trevor Lawrence"/>
<meta http-equiv="Content-Language" content="en-au"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

<!-- Internal JS -->
<script type="text/javascript">
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one
line...
if
(field.value.match(/(^(\S+@)\S+(((\.ac)|(\.aero)|(\.arpa)|(\.biz)|(\.co)|(\.com)|(\.coop)|(\.edu)|(\.firm)|(\.gov)|(\.info)|(\.int)|(\.jobs)|(\.mil)|(\.museum)|(\.name)|(\.nom)|(\.net)|(\.org)|(\.pro)|(\.store)|(\.travel)|(\.web))(\.\S{2})?)$)/i))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
// --------------------
function testform()
{
with (document.form1)
{
for (var i = 1; i <= 4 ; i++)
if (!checkEmailAddress(elements['Email' + i]))
return
var yesreply = yes.checked
var noreply = no.checked
if (yesreply == noreply)
{ alert ('Reply must be Yes or No')
return }
else
Joining.value = yesreply ? 'Yes' : 'No'
}
}
// --------------------
function sendform()
{
var recpt = ''
for (var i = 1; i <= 4 ; i++)
{
recpt += document.form1.elements['Email' + i].value
if (i < 4 )
recpt += ';'
}
with (document.form1)
{
var body = ''
var i = elements.length , j = 0
while (i-- > 2) // drop last two elements
{
var tname = elements[j].id
var text = (elements[j].checked) ? 'Yes' : elements[j].value
if (text != 'on' && tname != 'yes' && tname != 'no' &&
!tname.match(/(^Email)/))
{
body += tname + ": "
if (tname == "Comment")
body += '%0d%0a' // line break before comment text
body += text + '%0d%0a' // line break after each line
}
j += 1
} // end while
}
window.location = "mailto:" + recpt
+ "?subject=Response%20from%20Form1"
+ "&body=" + body
}
</script>
</head>
<body onload="">
<noscript>
This site requires Javascript enabled<br />
</noscript>
<div id="maindiv" align="center">
<div style="border:1px solid #999999; width:60%;
background-color:#F2F4FA;">
<form name="form1" action="">
<div style="background-color:#DBE0F5; padding:3px; font:75% arial;">
<b>Title</b>
</div>
<div style="padding:10px; font:75% Arial; text-align:left;">
<p>
Hi all,<br />
</p>
<p>
Email1:<br/>
<input type="text" id="Email1" value="Insert e-mail address"
size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Email2:<br/>
<input type="text" id="Email2" value="Insert e-mail address"
size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Email3:<br/>
<input type="text" id="Email3" value="Insert e-mail address"
size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Email4:<br/>
<input type="text" id="Email4" value="Insert e-mail address"
size="40"
onfocus="if (this.value=='Insert e-mail
address'){this.value='';};return false;"
onblur="if (this.value==''){this.value='Insert e-mail
address';return false;}"/><br/>
Do you want to join? <br/>
<input type="checkbox" id="yes" />Yes <br/>
<input type="checkbox" id="no" />No <br/>
<input type="hidden" id="Joining" size="3" />
</p>
Enter Comment:<br/>
<textarea id="Comment" rows="10" cols="100"
style="font:100% Arial;">Enter your comment in
here</textarea><br />
</div>
<div align="center" style="background-color:#DBE0F5; padding:3px;
font:12px arial;">
<input type="button" id="submit" value=" Send "
onmouseover="testform()" onclick="sendform()" />
<input type="reset" id="reset" value=" Clear "/>
</div>
</form>
</div>
</div>
</body>
</html>
 
T

Trevor L.

Andrew said:
Trevor I don't know if your answer is relevant to what the OP is
asking.
From what I can see, the OP wants a script to send an email with the
actual fields (i.e. the text area, the textbox, the radio buttons etc
with the email so it shows up in his email as the user views it when
submitting it.

Thanks, Andrew.

I sort of realised that so I added this sentence
In fact, what he wants probably isn't possible unless some server side stuff
can do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top