Form sent to users address

G

Guest

Hi,
I am using a simple form as a test for students who work their way through
a 'virtual tour' on our website. After the student takes the "test"--which
is a form, really; I would like to have the option for the student to send
his answers to an email address they input themselves. They could send their
answers to their own email address or a teacher's email address.
Is there a way to do this? I know that I can set up the form(test) to
email the results to me, but its going to do the student no good.
I thank you all in advance.
 
S

Steve Easton

That requires custom server side scripting.


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
T

Trevor L.

Steve said:
That requires custom server side scripting.

Steve,
I have noticed the same response from many MVPs.

Wouldn't the method below work ?
The feedback I had on this before is that the user must have an email client
which his/her browser will use as default, but won't most?

<html>
</head>
<script type="text/javascript">
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one line...
if
(field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}
// --------------------
function testform()
{
with (document.form1)
{
if (!checkEmailAddress(Email))
return
// more code to validate form results
}
}
// --------------------
function sendform()
{
with (document.form1)
{
var body = ''
var i = elements.length , j = 0
while (i-- > 2) // drop last two elements
{
if (elements[j].name != 'Email')
{ body += elements[j].name + ': ' + elements[j].value
+ '%0d%0a' // line break after each field }
j += 1
} // end while
}
window.location = "mailto:" + document.form1.Email.value
+ "?subject=Response%20from%20Form"
+ "&body=" + body
}
// --------------------
</script>
</head>

<body>
<div 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>Form Heading</b>
</div>

<div style="padding:10px; font:75% Arial; text-align:left;">
<p>
Hi all,<br />
<!-- Intro. Text in here -->

Name:<br/>
<input type="text" name="Name" value="Insert name" size="40"
onfocus="if (this.value=='Insert name'){this.value='';};return
false;"
onblur="if (this.value==''){this.value='Insert name';return
false;}"/><br/>

Email:<br/>
<input type="text" name="Email" 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/>

<!-- more fields in here -->
</p>
</div>

<!-- this <div> with these two fields to remain the last -->
<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>
</div>

</form>
</div>

</div>
</body>
</html>
 
S

Stefan B Rusynko

That (any mailto) is not using a forms handler and will fail for many user (especially all AOL users)

--

_____________________________________________
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
_____________________________________________


| > | >> Hi,
| >> I am using a simple form as a test for students who work their way
| >> through
| >> a 'virtual tour' on our website. After the student takes the
| >> "test"--which
| >> is a form, really; I would like to have the option for the student
| >> to send his answers to an email address they input themselves. They
| >> could send their
| >> answers to their own email address or a teacher's email address.
| >> Is there a way to do this? I know that I can set up the form(test)
| >> to email the results to me, but its going to do the student no good.
| >> I thank you all in advance.
|
| Steve Easton wrote:
| > That requires custom server side scripting.
|
| Steve,
| I have noticed the same response from many MVPs.
|
| Wouldn't the method below work ?
| The feedback I had on this before is that the user must have an email client
| which his/her browser will use as default, but won't most?
|
| <html>
| </head>
| <script type="text/javascript">
| function checkEmailAddress(field)
| {
| // the following expression in () after 'match' must be all on one line...
| if
| (field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
| return true
| else
| { alert('Please enter a valid e-mail address.')
| field.focus()
| field.select()
| return false }
| }
| // --------------------
| function testform()
| {
| with (document.form1)
| {
| if (!checkEmailAddress(Email))
| return
| // more code to validate form results
| }
| }
| // --------------------
| function sendform()
| {
| with (document.form1)
| {
| var body = ''
| var i = elements.length , j = 0
| while (i-- > 2) // drop last two elements
| {
| if (elements[j].name != 'Email')
| { body += elements[j].name + ': ' + elements[j].value
| + '%0d%0a' // line break after each field }
| j += 1
| } // end while
| }
| window.location = "mailto:" + document.form1.Email.value
| + "?subject=Response%20from%20Form"
| + "&body=" + body
| }
| // --------------------
| </script>
| </head>
|
| <body>
| <div 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>Form Heading</b>
| </div>
|
| <div style="padding:10px; font:75% Arial; text-align:left;">
| <p>
| Hi all,<br />
| <!-- Intro. Text in here -->
|
| Name:<br/>
| <input type="text" name="Name" value="Insert name" size="40"
| onfocus="if (this.value=='Insert name'){this.value='';};return
| false;"
| onblur="if (this.value==''){this.value='Insert name';return
| false;}"/><br/>
|
| Email:<br/>
| <input type="text" name="Email" 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/>
|
| <!-- more fields in here -->
| </p>
| </div>
|
| <!-- this <div> with these two fields to remain the last -->
| <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>
| </div>
|
| </form>
| </div>
|
| </div>
| </body>
| </html>
| --
| Cheers,
| Trevor L.
| Website: http://tandcl.homemail.com.au
|
|
 
G

Guest

Thanks for all who replied!
Very helpful.

Stefan B Rusynko said:
That (any mailto) is not using a forms handler and will fail for many user (especially all AOL users)

--

_____________________________________________
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
_____________________________________________


| > | >> Hi,
| >> I am using a simple form as a test for students who work their way
| >> through
| >> a 'virtual tour' on our website. After the student takes the
| >> "test"--which
| >> is a form, really; I would like to have the option for the student
| >> to send his answers to an email address they input themselves. They
| >> could send their
| >> answers to their own email address or a teacher's email address.
| >> Is there a way to do this? I know that I can set up the form(test)
| >> to email the results to me, but its going to do the student no good.
| >> I thank you all in advance.
|
| Steve Easton wrote:
| > That requires custom server side scripting.
|
| Steve,
| I have noticed the same response from many MVPs.
|
| Wouldn't the method below work ?
| The feedback I had on this before is that the user must have an email client
| which his/her browser will use as default, but won't most?
|
| <html>
| </head>
| <script type="text/javascript">
| function checkEmailAddress(field)
| {
| // the following expression in () after 'match' must be all on one line...
| if
| (field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
| return true
| else
| { alert('Please enter a valid e-mail address.')
| field.focus()
| field.select()
| return false }
| }
| // --------------------
| function testform()
| {
| with (document.form1)
| {
| if (!checkEmailAddress(Email))
| return
| // more code to validate form results
| }
| }
| // --------------------
| function sendform()
| {
| with (document.form1)
| {
| var body = ''
| var i = elements.length , j = 0
| while (i-- > 2) // drop last two elements
| {
| if (elements[j].name != 'Email')
| { body += elements[j].name + ': ' + elements[j].value
| + '%0d%0a' // line break after each field }
| j += 1
| } // end while
| }
| window.location = "mailto:" + document.form1.Email.value
| + "?subject=Response%20from%20Form"
| + "&body=" + body
| }
| // --------------------
| </script>
| </head>
|
| <body>
| <div 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>Form Heading</b>
| </div>
|
| <div style="padding:10px; font:75% Arial; text-align:left;">
| <p>
| Hi all,<br />
| <!-- Intro. Text in here -->
|
| Name:<br/>
| <input type="text" name="Name" value="Insert name" size="40"
| onfocus="if (this.value=='Insert name'){this.value='';};return
| false;"
| onblur="if (this.value==''){this.value='Insert name';return
| false;}"/><br/>
|
| Email:<br/>
| <input type="text" name="Email" 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/>
|
| <!-- more fields in here -->
| </p>
| </div>
|
| <!-- this <div> with these two fields to remain the last -->
| <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>
| </div>
|
| </form>
| </div>
|
| </div>
| </body>
| </html>
| --
| Cheers,
| Trevor L.
| Website: http://tandcl.homemail.com.au
|
|
 
M

MDBJ

Sidebar comment

(field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')

yea, my domain is a .info.. and there are MANY MANY MANY more TLD's than
just mine--
..biz, .name, etc.....

please don't exclude everyone...


http://www.iana.org/cctld/cctld-whois.htm for some.....

..ac - Ascension Island
..ad - Andorra
..ae - United Arab Emirates
..af - Afghanistan
..ag - Antigua and Barbuda
..ai - Anguilla
..al - Albania
..am - Armenia
..an - Netherlands Antilles
..ao - Angola
..aq - Antarctica
..ar - Argentina
..as - American Samoa
..at - Austria
..au - Australia
..aw - Aruba
..az - Azerbaijan
..ax - Aland Islands
..ba - Bosnia and Herzegovina
..bb - Barbados
..bd - Bangladesh
..be - Belgium
..bf - Burkina Faso
..bg - Bulgaria
..bh - Bahrain
..bi - Burundi
..bj - Benin
..bm - Bermuda
..bn - Brunei Darussalam
..bo - Bolivia
..br - Brazil
..bs - Bahamas
..bt - Bhutan
..bv - Bouvet Island
..bw - Botswana
..by - Belarus
..bz - Belize
..ca - Canada
..cc - Cocos (Keeling) Islands
..cd - Congo, The Democratic Republic of the
..cf - Central African Republic
..cg - Congo, Republic of
..ch - Switzerland
..ci - Cote d'Ivoire
..ck - Cook Islands
..cl - Chile
..cm - Cameroon
..cn - China
..co - Colombia
..cr - Costa Rica
..cs - Serbia and Montenegro
..cu - Cuba
..cv - Cape Verde
..cx - Christmas Island
..cy - Cyprus
..cz - Czech Republic
..de - Germany
..dj - Djibouti
..dk - Denmark
..dm - Dominica
..do - Dominican Republic
..dz - Algeria
..ec - Ecuador
..ee - Estonia
..eg - Egypt
..eh - Western Sahara
..er - Eritrea
..es - Spain
..et - Ethiopia
..eu - European Union
..fi - Finland
..fj - Fiji
..fk - Falkland Islands (Malvinas)
..fm - Micronesia, Federal State of
..fo - Faroe Islands
..fr - France
..ga - Gabon
..gb - United Kingdom
..gd - Grenada
..ge - Georgia
..gf - French Guiana
..gg - Guernsey
..gh - Ghana
..gi - Gibraltar
..gl - Greenland
..gm - Gambia
..gn - Guinea
..gp - Guadeloupe
..gq - Equatorial Guinea
..gr - Greece
..gs - South Georgia and the South Sandwich Islands
..gt - Guatemala
..gu - Guam
..gw - Guinea-Bissau
..gy - Guyana
..hk - Hong Kong
..hm - Heard and McDonald Islands
..hn - Honduras
..hr - Croatia/Hrvatska
..ht - Haiti
..hu - Hungary
..id - Indonesia
..ie - Ireland
..il - Israel
..im - Isle of Man
..in - India
..io - British Indian Ocean Territory
..iq - Iraq
..ir - Iran, Islamic Republic of
..is - Iceland
..it - Italy
..je - Jersey
..jm - Jamaica
..jo - Jordan
..jp - Japan
..ke - Kenya
..kg - Kyrgyzstan
..kh - Cambodia
..ki - Kiribati
..km - Comoros
..kn - Saint Kitts and Nevis
..kp - Korea, Democratic People's Republic
..kr - Korea, Republic of
..kw - Kuwait
..ky - Cayman Islands
..kz - Kazakhstan
..la - Lao People's Democratic Republic
..lb - Lebanon
..lc - Saint Lucia
..li - Liechtenstein
..lk - Sri Lanka
..lr - Liberia
..ls - Lesotho
..lt - Lithuania
..lu - Luxembourg
..lv - Latvia
..ly - Libyan Arab Jamahiriya
..ma - Morocco
..mc - Monaco
..md - Moldova, Republic of
..mg - Madagascar
..mh - Marshall Islands
..mk - Macedonia, The Former Yugoslav Republic of
..ml - Mali
..mm - Myanmar
..mn - Mongolia
..mo - Macau
..mp - Northern Mariana Islands
..mq - Martinique
..mr - Mauritania
..ms - Montserrat
..mt - Malta
..mu - Mauritius
..mv - Maldives
..mw - Malawi
..mx - Mexico
..my - Malaysia
..mz - Mozambique
..na - Namibia
..nc - New Caledonia
..ne - Niger
..nf - Norfolk Island
..ng - Nigeria
..ni - Nicaragua
..nl - Netherlands
..no - Norway
..np - Nepal
..nr - Nauru
..nu - Niue
..nz - New Zealand
..om - Oman
..pa - Panama
..pe - Peru
..pf - French Polynesia
..pg - Papua New Guinea
..ph - Philippines
..pk - Pakistan
..pl - Poland
..pm - Saint Pierre and Miquelon
..pn - Pitcairn Island
..pr - Puerto Rico
..ps - Palestinian Territories
..pt - Portugal
..pw - Palau
..py - Paraguay
..qa - Qatar
..re - Reunion Island
..ro - Romania
..ru - Russian Federation
..rw - Rwanda
..sa - Saudi Arabia
..sb - Solomon Islands
..sc - Seychelles
..sd - Sudan
..se - Sweden
..sg - Singapore
..sh - Saint Helena
..si - Slovenia
..sj - Svalbard and Jan Mayen Islands
..sk - Slovak Republic
..sl - Sierra Leone
..sm - San Marino
..sn - Senegal
..so - Somalia
..sr - Suriname
..st - Sao Tome and Principe
..sv - El Salvador
..sy - Syrian Arab Republic
..sz - Swaziland
..tc - Turks and Caicos Islands
..td - Chad
..tf - French Southern Territories
..tg - Togo
..th - Thailand
..tj - Tajikistan
..tk - Tokelau
..tl - Timor-Leste
..tm - Turkmenistan
..tn - Tunisia
..to - Tonga
..tp - East Timor
..tr - Turkey
..tt - Trinidad and Tobago
..tv - Tuvalu
..tw - Taiwan
..tz - Tanzania
..ua - Ukraine
..ug - Uganda
..uk - United Kingdom
..um - United States Minor Outlying Islands
..us - United States
..uy - Uruguay
..uz - Uzbekistan
..va - Holy See (Vatican City State)
..vc - Saint Vincent and the Grenadines
..ve - Venezuela
..vg - Virgin Islands, British
..vi - Virgin Islands, U.S.
..vn - Vietnam
..vu - Vanuatu
..wf - Wallis and Futuna Islands
..ws - Western Samoa
..ye - Yemen
..yt - Mayotte
..yu - Yugoslavia
..za - South Africa
..zm - Zambia
..zw - Zimbabwe
 
T

Trevor L.

MDBJ said:
Sidebar comment



yea, my domain is a .info.. and there are MANY MANY MANY more TLD's
than just mine--
.biz, .name, etc.....

please don't exclude everyone...

Many thanks for that.

I did sight the list of countries once (and I think I saved it somewhere on
my PC), but my script does not cause a rejection of any country code. After
all, my email address ends in .com.au and is accepted by this script.

Is this because of an error in the script, or is this what it should do.
Perhaps 2 character extensions are permitted by |(\..{2,2}).
(My knowledge of regular expressions is not very great.)

However, I would be grateful to get a full list of the other extensions

So far, including what you have written, I know of:
..info
..biz
..name (this surprises me)
..tv

Can you add to this list ?
 
T

Trevor L.

Trevor said:
However, I would be grateful to get a full list of the other
extensions
So far, including what you have written, I know of:
.info
.biz
.name (this surprises me)
.tv

Can you add to this list ?

MDBJ,
I find that my script will accept a name with any 2-char suffix.

The script is
function checkEmailAddress(field)
{
// the following expression in () after 'match' must be all on one line...
if
(field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\.info)|(\.biz)|(\.name)|(\..{2,2}))$)\b/gi))
return true
else
{ alert('Please enter a valid e-mail address.')
field.focus()
field.select()
return false }
}

Do any regexp experts out there know how to modify this so that if a
2-character country suffix exists check the letters before this.
And if the 2-character country suffix does not exist, check the text after
the last dot or period (.)

When the name is
(e-mail address removed)
check that .bix is valid

When the name is
(e-mail address removed)
check that .bix is valid

In both cases, the answer should be invalid, whereas my script will accept
the first.
 

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