adding form fields to get subject heading of email

1

1 Just Jeff

Hi,

Win98
FP2000

In using forms to give on-line tests, I wanted to join 3 fields together to
serve as the subject of the e-mail being sent to me. I was given advice by
Jim Buyens and have tried to implement his suggestions - but I seem to be
missing something - it is more than likely my understanding. Here's is what
I would like:

Expectation: Test #1 PHY 221 I01 John Doe

I would like the following 3 items grouped together

title: Test #1 PHY 221
section number: I01
student name: John Doe

I would have the title (Test #1 PHY 221) already written within the form but
I need to the student to pick one of 3 sections numbers using radio buttons
(I01, I02, I03) and then enter their name in a text field.


All of this would be within a form which contains questions and problems.


Here's the present html with the questions and problems removed for space:
(also there is no subject field - but that is what I want to create).


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>fftest</title>
</head>
<form method="POST" name="FrontPage_Form1" action="--WEBBOT-SELF--"
onsubmit="return FrontPage_Form1_Validator(this)">
<!--webbot bot="SaveResults" U-File="fftest_data.html" S-Format="HTML/BR"
S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE" S-Email-Format="HTML/BR"
[email protected] B-Email-Label-Fields="TRUE"
B-Email-ReplyTo-From-Field="TRUE" S-Email-ReplyTo="Email"
B-Email-Subject-From-Field="TRUE" S-Email-Subject="subject"
S-Date-Format="%A, %B %d, %Y" S-Time-Format="%I:%M:%S %p"
S-Builtin-Fields="Date Time" -->

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">Test
#1 PHY 221</p>


<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">Section
Number</p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0"><input type="radio" value="I01" name="section">
I01 <input type="radio" value="I02" name="section"> I02 <input
type="radio" value="I03" name="section">
I03</p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">&nbsp;</p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">Name</p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0"><input type="text" name="name" size="20"></p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">&nbsp;</p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">E-mail</p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0"><input type="text" name="Email" size="20"></p>

<p align="left" style="word-spacing: 0; line-height: 100%; margin:
0">&nbsp;</p>

<p align="center" style="word-spacing: 0; margin-top: 0; margin-bottom:
0"><font size="2"><input type="submit" value="Submit Test"></font></p>
</form>
</body>
</html>




Here's was Jim Buyens' suggestion (except then the section number was to be
a text field) which I never got to work...

========================================
Try this:

<form name="form1" method="POST">
<script>
function bldSubj(){
form1.subject.value = "Test #2 PHY 221" + " " +
form1.section.value + " " +
form1.stuname.value;
}
</script>
<p>Class Section:<br><input type="text" name="section"
size="20" onchange="bldSubj();"></p>
<p>Student Name:<br><input type="text" name="stuname"
size="20" onchange="bldSubj();"></p>
<p>Subject:<br><input type="text" name="subject"
size="50"></p>
<p><input type="submit" value="Submit"
name="btnSub"></p>
</form>

The onchange attributes on the section and stuname tags
cause the function bldSubj to run every time the visitor
updates those fields. The bldSubj function assembles the
subject line you want.

Once you get this working, you can change the subject tag
to a hidden form field, as in

<input type="hidden" name="subject">

Jim Buyens
Microsoft FrontPage MVP



-thanks,
Jeffrey
 
J

Jim Buyens

-----Original Message-----
Hi,
Howdy.

Win98
FP2000

In using forms to give on-line tests, I wanted to join 3
fields together to serve as the subject of the e-mail
being sent to me. I was given advice by Jim Buyens and
have tried to implement his suggestions - but I seem to
be missing something - it is more than likely my
understanding.

It makes a difference that one of the form elements is a
set of radio buttons. Also, you forgot the hidden form
field that holds the joined result.

Try this:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="--WEBBOT-SELF--" onsubmit="return
FrontPage_Form1_Validator(this)">
<!--webbot bot="SaveResults" u-file="fftest_data.html"
s-format="HTML/BR" s-label-fields="TRUE" b-reverse-
chronology="FALSE" s-email-format="HTML/BR" s-email-
address="(e-mail address removed)" b-email-label-
fields="TRUE" b-email-replyto-from-field="TRUE" s-email-
replyto="Email" b-email-subject-from-field="TRUE" s-email-
subject="subject" s-date-format="%A, %B %d, %Y" s-time-
format="%I:%M:%S %p" s-builtin-fields="Date Time" -->

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</form>

</body>

</html>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*========----------
|\=========------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/=========------------
*========----------
 
1

1 Just Jeff

Jim,
Thank you very much for this help. It worked perfectly. I also enjoyed
studying the html - I learned much.
-Jeffrey







Jim Buyens said:
-----Original Message-----
Hi,
Howdy.

Win98
FP2000

In using forms to give on-line tests, I wanted to join 3
fields together to serve as the subject of the e-mail
being sent to me. I was given advice by Jim Buyens and
have tried to implement his suggestions - but I seem to
be missing something - it is more than likely my
understanding.

It makes a difference that one of the form elements is a
set of radio buttons. Also, you forgot the hidden form
field that holds the joined result.

Try this:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="--WEBBOT-SELF--" onsubmit="return
FrontPage_Form1_Validator(this)">
<!--webbot bot="SaveResults" u-file="fftest_data.html"
s-format="HTML/BR" s-label-fields="TRUE" b-reverse-
chronology="FALSE" s-email-format="HTML/BR" s-email-
address="(e-mail address removed)" b-email-label-
fields="TRUE" b-email-replyto-from-field="TRUE" s-email-
replyto="Email" b-email-subject-from-field="TRUE" s-email-
subject="subject" s-date-format="%A, %B %d, %Y" s-time-
format="%I:%M:%S %p" s-builtin-fields="Date Time" -->

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</form>

</body>

</html>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*========----------
|\=========------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/=========------------
*========----------
 
1

1 Just Jeff

Hi Jim,

If I may follow-up on your advice, I have come across an issue.

Yesterday when I insert the code you provided (shown below, #1), it seemed
to work fine by
itself - I thought, but today when I started adding other materials like
questions and comments - bugs
cropped up like the submit button ceasing to function at one point and then
error messages

Cannot run the FrontPage Server Extensions' Smart HTML interpreter on this
non-HTML page: "http://www.midlandstech.edu/jlh/form_template.htm" - (this
link is the location)

That's when I noticed that the"form" borders were not showing in the normal
view on FP2000 for the code.

So then I highlighted the material in normal view and clicked "form", then I
applied conditions to the form (Form Properties and Options for Saving
Results of Forms).

So with the form added and conditions entered - it works - but there is a
rub.
It works - of course - after I save (not close in FP) the edited page (see
code below yours, #2) and then test it out on line.

HERE'S THE PROBLEM: After I save the changes that gets the page to work, I
close the window. When I open it back up, the additions I made are gone. The
main form is missing, the conditions are missing, and the webpage fails to
work again, and I am not able to access the Form Conditions within FP
because there seems to be no form!

It seems FP will not save and remember the changes I made (FP modified code
is also below, #3)

Any idea?




#1
Here's what I inserted...original code
===================================================================
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="--WEBBOT-SELF--" onsubmit="return
FrontPage_Form1_Validator(this)">
<!--webbot bot="SaveResults" u-file="fftest_data.html"
s-format="HTML/BR" s-label-fields="TRUE" b-reverse-
chronology="FALSE" s-email-format="HTML/BR" s-email-
address="(e-mail address removed)" b-email-label-
fields="TRUE" b-email-replyto-from-field="TRUE" s-email-
replyto="Email" b-email-subject-from-field="TRUE" s-email-
subject="subject" s-date-format="%A, %B %d, %Y" s-time-
format="%I:%M:%S %p" s-builtin-fields="Date Time" -->

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</form>

</body>

</html>

===================================================================



#2
updated code with Form installed and conditions applied

===================================================
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="_vti_bin/shtml.dll/form_template.htm"
webbot-action="--WEBBOT-SELF--">

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<FORM METHOD="POST" ACTION="--WEBBOT-SELF--">
<!--WEBBOT BOT="SaveResults" U-File="_private/form_results.txt"
S-Format="HTML/BR" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
S-Email-Format="HTML/BR" S-Email-Address="(e-mail address removed)"
B-Email-Label-Fields="TRUE" B-Email-ReplyTo-From-Field="TRUE"
S-Email-ReplyTo="Email" B-Email-Subject-From-Field="TRUE"
S-Email-Subject="subject" S-Date-Format="%A, %B %d, %Y"
S-Time-Format="%I:%M:%S %p" S-Builtin-Fields="Date Time" -->
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</FORM>
</form>

</html>

===================================================

#3
FP2000 modifications to code upon saving and closing page and then
reopening...
===================================================
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="_vti_bin/shtml.dll/form_template.htm"
webbot-action="--WEBBOT-SELF--">

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<FORM METHOD="POST" ACTION="_vti_bin/shtml.dll/form_template.htm"
webbot-action="--WEBBOT-SELF--">
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</FORM>
</form>

</html>


===================================================
 
T

Thomas A. Rowe

You can not use FP Form Field validation (JavaScript) at the same time that
you are also using custom validation or JavaScript.

You have to apply the FP Form Field Validation, preview in your browser,
copy the FP generated JavaScript to notepad, then remove all FP validation
from your form fields and save your form.

Next add your modification to the FP generated JavaScript code that you
copied to notepad.

Next add the combined modified code back to your form in HTML view. Make
sure to change the name of the form and the script to something other than
how FP names forms.

--

==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, Forums, WebCircle,
MS KB Quick Links, etc.
==============================================


1 Just Jeff said:
Hi Jim,

If I may follow-up on your advice, I have come across an issue.

Yesterday when I insert the code you provided (shown below, #1), it seemed
to work fine by
itself - I thought, but today when I started adding other materials like
questions and comments - bugs
cropped up like the submit button ceasing to function at one point and then
error messages

Cannot run the FrontPage Server Extensions' Smart HTML interpreter on this
non-HTML page: "http://www.midlandstech.edu/jlh/form_template.htm" - (this
link is the location)

That's when I noticed that the"form" borders were not showing in the normal
view on FP2000 for the code.

So then I highlighted the material in normal view and clicked "form", then I
applied conditions to the form (Form Properties and Options for Saving
Results of Forms).

So with the form added and conditions entered - it works - but there is a
rub.
It works - of course - after I save (not close in FP) the edited page (see
code below yours, #2) and then test it out on line.

HERE'S THE PROBLEM: After I save the changes that gets the page to work, I
close the window. When I open it back up, the additions I made are gone. The
main form is missing, the conditions are missing, and the webpage fails to
work again, and I am not able to access the Form Conditions within FP
because there seems to be no form!

It seems FP will not save and remember the changes I made (FP modified code
is also below, #3)

Any idea?




#1
Here's what I inserted...original code
===================================================================
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="--WEBBOT-SELF--" onsubmit="return
FrontPage_Form1_Validator(this)">
<!--webbot bot="SaveResults" u-file="fftest_data.html"
s-format="HTML/BR" s-label-fields="TRUE" b-reverse-
chronology="FALSE" s-email-format="HTML/BR" s-email-
address="(e-mail address removed)" b-email-label-
fields="TRUE" b-email-replyto-from-field="TRUE" s-email-
replyto="Email" b-email-subject-from-field="TRUE" s-email-
subject="subject" s-date-format="%A, %B %d, %Y" s-time-
format="%I:%M:%S %p" s-builtin-fields="Date Time" -->

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</form>

</body>

</html>

===================================================================



#2
updated code with Form installed and conditions applied

===================================================
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="_vti_bin/shtml.dll/form_template.htm"
webbot-action="--WEBBOT-SELF--">

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<FORM METHOD="POST" ACTION="--WEBBOT-SELF--">
<!--WEBBOT BOT="SaveResults" U-File="_private/form_results.txt"
S-Format="HTML/BR" S-Label-Fields="TRUE" B-Reverse-Chronology="FALSE"
S-Email-Format="HTML/BR" S-Email-Address="(e-mail address removed)"
B-Email-Label-Fields="TRUE" B-Email-ReplyTo-From-Field="TRUE"
S-Email-ReplyTo="Email" B-Email-Subject-From-Field="TRUE"
S-Email-Subject="subject" S-Date-Format="%A, %B %d, %Y"
S-Time-Format="%I:%M:%S %p" S-Builtin-Fields="Date Time" -->
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</FORM>
</form>

</html>

===================================================

#3
FP2000 modifications to code upon saving and closing page and then
reopening...
===================================================
<html>

<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<META NAME="GENERATOR" CONTENT="Microsoft FrontPage 4.0">
<title>fftest</title>
</head>

<form name="form1" method="POST" name="FrontPage_Form1"
action="_vti_bin/shtml.dll/form_template.htm"
webbot-action="--WEBBOT-SELF--">

<script>
function bldSubj(){
sect = "";
for (pos = 0; pos < 3; pos++) {
if (form1.section[pos].checked) {
sect = form1.section[pos].value;
}
}
form1.subject.value = "Test #2 PHY 221" + " " +
sect + " " +
form1.name.value;
form1.submit();
}
</script>
<input type="hidden" name="subject" value="">
<FORM METHOD="POST" ACTION="_vti_bin/shtml.dll/form_template.htm"
webbot-action="--WEBBOT-SELF--">
<p>Test #1 PHY 221</p>
<p>Section Number<br>
<input type="radio" value="I01" name="section"> I01
<input type="radio" value="I02" name="section"> I02
<input type="radio" value="I03" name="section"> I03</p>
<p>Name<br>
<input type="text" name="name"></p>
<p>E-mail<br>
<input type="text" name="Email"></p>
<p><input type="button" value="Submit Test"
name="btnSub" onclick="bldSubj();"></p>
</FORM>
</form>

</html>


===================================================
 
J

Jim Buyens

1 Just Jeff said:
Hi Jim,
Howdy.

If I may follow-up on your advice, I have come across an issue.

Yesterday when I insert the code you provided (shown below, #1), it seemed
to work fine by
itself - I thought, but today when I started adding other materials like
questions and comments - bugs
cropped up like the submit button ceasing to function at one point and then
error messages

Cannot run the FrontPage Server Extensions' Smart HTML interpreter on this
non-HTML page: "http://www.midlandstech.edu/jlh/form_template.htm" - (this
link is the location)

That's when I noticed that the"form" borders were not showing in the normal
view on FP2000 for the code.

Chances are, you forgot to close a tag or have one inproperly nested
somewhere. For example, you may have forgotten a </table> tag, or you
coded:

<form>
<table>
<tr>
<td>Whatever</td>
</tr>
<tr>
<td></form></td>
</tr>
</table>

Also, be sure NOT to add a Submit button to the form. Add an ordinary
pushbutton with an onclick event handler that runs a JavaScript
function, and have the JavaScript function call form1.submit(); after
it does whatever else you want. Of course, then, be sure to code
name="form1" in the <form> tag.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*========----------
|\=========------------
|| Microsoft Office FrontPage 2003 Inside Out
|| Microsoft FrontPage Version 2002 Inside Out
|| Web Database Development Step by Step .NET Edition
|| Troubleshooting Microsoft FrontPage 2002
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/=========------------
*========----------
 

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