Require at LEAST ONE checkbox in a long list, using formmail
- plumloopy
- Newbie


- Joined: Jun 11, 2004
- Posts: 5
- Status: Offline
First of all, I've examined http://www.ozzu.com/programming-forum/perl-help-validating-more-than-one-field-t25433.html which deals with this somewhat, but I haven't had luck yet. Possibly this solution will work for me but I've had trouble thus far. I'm open to using Java but this particular page currently has none.
Here is my code:
<font size="-1">CHOOSE FROM CURRENT AND FORTHCOMING TITLES:</font>
</font></font></b></td></tr>
<tr><td valign="top" width="44" bgcolor="#000090" bordercolor="#FFFFFF">
<input type="checkbox" name="al3" value="al3"><br>
<b><font face="Arial, Helvetica"><font color="#ffffff">
<font size="-1"> Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a href="active3.html">THE ACTIVE LEARNER: SUCCESSFUL STUDY STRATEGIES, 3rd ed.</a>
</font></font></b></td></tr>
<tr><td valign="top" width="44" bgcolor="#000090" bordercolor="#FFFFFF">
<input type="checkbox" name="dcj2" value="dcj2"><br>
<b><font face="Arial, Helvetica"><font color="#ffffff">
<font size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a href="roxdictionary2.html">THE AMERICAN DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS AND MAJOR COURT CASES, 2nd ed.</a>
</font></font></b></td></tr>
and then it goes on for about 100 books like this.
The point is we have people who check NO books and the form succesfully sends an essentially useless email to us. I'm open to using an entirely different script as long as it has this capability. Basically, we want to be sent a list of information about the user (with many required fields) and then have them check which titles they want (at least one required).
THANKS FOR YOUR HELP!!!
Chris
I
Here is my code:
<font size="-1">CHOOSE FROM CURRENT AND FORTHCOMING TITLES:</font>
</font></font></b></td></tr>
<tr><td valign="top" width="44" bgcolor="#000090" bordercolor="#FFFFFF">
<input type="checkbox" name="al3" value="al3"><br>
<b><font face="Arial, Helvetica"><font color="#ffffff">
<font size="-1"> Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a href="active3.html">THE ACTIVE LEARNER: SUCCESSFUL STUDY STRATEGIES, 3rd ed.</a>
</font></font></b></td></tr>
<tr><td valign="top" width="44" bgcolor="#000090" bordercolor="#FFFFFF">
<input type="checkbox" name="dcj2" value="dcj2"><br>
<b><font face="Arial, Helvetica"><font color="#ffffff">
<font size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a href="roxdictionary2.html">THE AMERICAN DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS AND MAJOR COURT CASES, 2nd ed.</a>
</font></font></b></td></tr>
and then it goes on for about 100 books like this.
The point is we have people who check NO books and the form succesfully sends an essentially useless email to us. I'm open to using an entirely different script as long as it has this capability. Basically, we want to be sent a list of information about the user (with many required fields) and then have them check which titles they want (at least one required).
THANKS FOR YOUR HELP!!!
Chris
I
- Anonymous
- Bot


- Joined: 25 Feb 2008
- Posts: ?
- Loc: Ozzuland
- Status: Online
June 11th, 2004, 3:47 pm
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
hey,
Below is an example I created for a class I taught a few months ago to some of the IT programmers here who were interested in learning basic web development. I included a number of comments, hopefully they will suffice to help you adapt this to your form. Let me know if you have any questions.
<html>
<head>
<title>Example</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<script LANGUAGE="JavaScript" TYPE="text/javascript">
/* Declare global variables for the error message */
var invalid_errors = "";
var blank_errors = "";
var error = "";
/*instantiate and populate and array containing the field names for each required field. */
var reqs = new Array();
reqs[0] = "name";
reqs[1] = "address";
reqs[2] = "phone";
reqs[3] = "state";
reqs[4] = "zip";
reqs[5] = "email";
reqs[6] = "birthdate";
reqs[7] = "account";
reqs[8] = "pin";
reqs[9] = "credittype";
reqs[10] = "creditaccount";
reqs[11] = "creditexp";
/*
validate required the form object as input. It depends upon two other functions:
isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
it returns false and cancels form submission. It also concats all errors and displays them
in a single alert popup that designates whether a required value was omitted or whether a
value entered was invalid.
*/
function validate(obj){
for(i=0;(i<reqs.length);i++){
element = eval(obj.elements[reqs[i]]);
if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
}
if(blank_errors.length != 0 || invalid_errors.length != 0){
if(blank_errors.length != 0){ error += "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
if(invalid_errors.length != 0){ error += "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
alert(error);
return false;
}
else{ return true; }
}
/*
isBlank simply tests whether a value is blank or not.
It returns true if the value is blank,
It returns false if the value has ANY value. The type of value does not matter.
isBlank requires a form element object as an argument.
*/
isBlanke
function isBlank(obj){
if(obj.value == ""){ return true; }
else{ return false; }
}
/*
doTrim simply chomps whitespace from boths sides of a value.
It will leave whitespace inside of the input string alone.
doTrim is not depenedant on any other function and requires
a form object as an arguement. It also requires that the array
of required elements be instantiated.
*/
function doTrim(obj){
if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
obj.value = obj.value.replace(/^\s+/g,"");
obj.value = obj.value.replace(/\s+$/g,"");
return true;
}
/*
isInvalid tests whether values pass various validity checks, based on the value itself.
The function takes two arguments, one is a form element object, the other is an integer
that should correspond an array element in the required field array. If a given field
passes its validity test, or if the field name is not listed in the switch logic,
the function will return false. If the string does not pass it the validity check, the function
returns true.
*/
function isInvalid(obj,item){
switch(reqs[item]) {
case "name": if(!obj.value.match(/[a-zA-Z ]+/)){ obj.value = ""; return true; }
break;
case "phone": if(!obj.value.match(/[\d]{3}-[\d]{3}-[\d]{4}/)){ obj.value = ""; return true; }
break;
case "state": if(!obj.value.match(/[A-Z]{2}/)){ obj.value = ""; return true; }
break;
case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
break;
case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
break;
case "birthdate": if(!obj.value.match(/[\d]{2}\/[\d]{2}\/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "pin": if(!obj.value.match(/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "account": if(!obj.value.match(/[\d]{6}/)){ obj.value = ""; return true; }
break;
case "creditaccount": if(!obj.value.match(/[\d]{12}|[\d]{16}/)){ obj.value = ""; return true; }
break;
case "creditexp": if(!obj.value.match(/[\d]{2}\/[\d]{2}/)){ obj.value = ""; return true; }
break;
default: return false;
}
return false;
}
</script>
</head>
<form NAME="form1" ACTION="form.html" METHOD="post" onSubmit="return validate(this);">
<table border="1" ALIGN="center" bgCOLOR="#cccccc">
<tr><td>Name:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="name" ID="Name" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="address" ID="Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>City:</td><td><input TYPE="text" NAME="city" ID="City" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>State:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="state" ID="State" SIZE="3" MAXLENGTH="2" onBlur="doTrim(this);"></td></tr>
<tr><td>ZIP:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="zip" ID="ZIP" SIZE="11" MAXLENGTH="10" onBlur="doTrim(this);"></td></tr>
<tr><td>Phone:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="phone" ID="Phone" SIZE="13" MAXLENGTH="12" onBlur="doTrim(this);"> (555-555-5555)</td></tr>
<tr><td>E-Mail Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Date of Birth:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="birthdate" ID="Date of Birth" SIZE="10" onBlur="doTrim(this);"> (MM/DD/YYYY)</td></tr>
<tr><td VALIGN="top">Seating Preferences:</td>
<td>
<select NAME="SeatingPref" MULTIPLE SIZE="5">
<option VALUE="Aisle">Aisle</option>
<option VALUE="Center">Center</option>
<option VALUE="Window">Window</option>
<option VALUE="Forward">Forward</option>
<option VALUE="Rear">Rear</option>
</select>
</td>
</tr>
<tr><td VALIGN="top">Meal Preference:</td>
<td>
<input TYPE="radio" NAME="MealPref" VALUE="Standard" CHECKED> Standard
<input TYPE="radio" NAME="MealPref" VALUE="Low-Cal"> Low-Cal
<input TYPE="radio" NAME="MealPref" VALUE="Low-Salt"> Low-Salt<br>
<input TYPE="radio" NAME="MealPref" VALUE="Kosher"> Kosher
<input TYPE="radio" NAME="MealPref" VALUE="Vegetarian"> Vegetarian
</td>
</tr>
<tr><td VALIGN="top">Information Request:</td>
<td>
<input TYPE="checkbox" NAME="InfoReq" VALUE="CarRental"> Car Rental
<input TYPE="checkbox" NAME="InfoReq" VALUE="PublicTransit"> Public Transit
<input TYPE="checkbox" NAME="InfoReq" VALUE="Lodging"> Lodging<br>
<input TYPE="checkbox" NAME="InfoReq" VALUE="Attractions"> Tourist Attractions
</td>
</tr>
<tr><td>Travel Account:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="account" ID="Travel Account" SIZE="7" MAXLENGTH="6" onBlur="doTrim(this);"></td></tr>
<tr><td>Travel Account PIN:<font COLOR="#ff0000">*</font></td><td><input TYPE="password" NAME="pin" ID="Travel Account PIN" SIZE="5" MAXLENGTH="4" onBlur="doTrim(this);"></td></tr>
<tr><td VALIGN="top">Credit Card Type:<font COLOR="#ff0000">*</font></td>
<td>
<select NAME="credittype" ID="Credit Card Type">
<option VALUE="">Please select one...</option>
<option VALUE="amex">American Express</option>
<option VALUE="discover">Discover</option>
<option VALUE="mc">MasterCard</option>
<option VALUE="visa">Visa</option>
</select>
</td>
</tr>
<tr><td>Credit Card Number:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditaccount" ID="Credit Card Number" SIZE="17" MAXLENGTH="16" onBlur="doTrim(this);"> (No spaces please)</td></tr>
<tr><td>Expiration Date:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditexp" ID="Expiration Date" SIZE="6" MAXLENGTH="5" onBlur="doTrim(this);"> (MM/YY)</td></tr>
<tr><td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
</tr>
</table>
<p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
</form>
</body>
</html>
Below is an example I created for a class I taught a few months ago to some of the IT programmers here who were interested in learning basic web development. I included a number of comments, hopefully they will suffice to help you adapt this to your form. Let me know if you have any questions.
Code: [ Select ]
<html>
<head>
<title>Example</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<script LANGUAGE="JavaScript" TYPE="text/javascript">
/* Declare global variables for the error message */
var invalid_errors = "";
var blank_errors = "";
var error = "";
/*instantiate and populate and array containing the field names for each required field. */
var reqs = new Array();
reqs[0] = "name";
reqs[1] = "address";
reqs[2] = "phone";
reqs[3] = "state";
reqs[4] = "zip";
reqs[5] = "email";
reqs[6] = "birthdate";
reqs[7] = "account";
reqs[8] = "pin";
reqs[9] = "credittype";
reqs[10] = "creditaccount";
reqs[11] = "creditexp";
/*
validate required the form object as input. It depends upon two other functions:
isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
it returns false and cancels form submission. It also concats all errors and displays them
in a single alert popup that designates whether a required value was omitted or whether a
value entered was invalid.
*/
function validate(obj){
for(i=0;(i<reqs.length);i++){
element = eval(obj.elements[reqs[i]]);
if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
}
if(blank_errors.length != 0 || invalid_errors.length != 0){
if(blank_errors.length != 0){ error += "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
if(invalid_errors.length != 0){ error += "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
alert(error);
return false;
}
else{ return true; }
}
/*
isBlank simply tests whether a value is blank or not.
It returns true if the value is blank,
It returns false if the value has ANY value. The type of value does not matter.
isBlank requires a form element object as an argument.
*/
isBlanke
function isBlank(obj){
if(obj.value == ""){ return true; }
else{ return false; }
}
/*
doTrim simply chomps whitespace from boths sides of a value.
It will leave whitespace inside of the input string alone.
doTrim is not depenedant on any other function and requires
a form object as an arguement. It also requires that the array
of required elements be instantiated.
*/
function doTrim(obj){
if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
obj.value = obj.value.replace(/^\s+/g,"");
obj.value = obj.value.replace(/\s+$/g,"");
return true;
}
/*
isInvalid tests whether values pass various validity checks, based on the value itself.
The function takes two arguments, one is a form element object, the other is an integer
that should correspond an array element in the required field array. If a given field
passes its validity test, or if the field name is not listed in the switch logic,
the function will return false. If the string does not pass it the validity check, the function
returns true.
*/
function isInvalid(obj,item){
switch(reqs[item]) {
case "name": if(!obj.value.match(/[a-zA-Z ]+/)){ obj.value = ""; return true; }
break;
case "phone": if(!obj.value.match(/[\d]{3}-[\d]{3}-[\d]{4}/)){ obj.value = ""; return true; }
break;
case "state": if(!obj.value.match(/[A-Z]{2}/)){ obj.value = ""; return true; }
break;
case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
break;
case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
break;
case "birthdate": if(!obj.value.match(/[\d]{2}\/[\d]{2}\/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "pin": if(!obj.value.match(/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "account": if(!obj.value.match(/[\d]{6}/)){ obj.value = ""; return true; }
break;
case "creditaccount": if(!obj.value.match(/[\d]{12}|[\d]{16}/)){ obj.value = ""; return true; }
break;
case "creditexp": if(!obj.value.match(/[\d]{2}\/[\d]{2}/)){ obj.value = ""; return true; }
break;
default: return false;
}
return false;
}
</script>
</head>
<form NAME="form1" ACTION="form.html" METHOD="post" onSubmit="return validate(this);">
<table border="1" ALIGN="center" bgCOLOR="#cccccc">
<tr><td>Name:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="name" ID="Name" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="address" ID="Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>City:</td><td><input TYPE="text" NAME="city" ID="City" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>State:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="state" ID="State" SIZE="3" MAXLENGTH="2" onBlur="doTrim(this);"></td></tr>
<tr><td>ZIP:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="zip" ID="ZIP" SIZE="11" MAXLENGTH="10" onBlur="doTrim(this);"></td></tr>
<tr><td>Phone:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="phone" ID="Phone" SIZE="13" MAXLENGTH="12" onBlur="doTrim(this);"> (555-555-5555)</td></tr>
<tr><td>E-Mail Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Date of Birth:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="birthdate" ID="Date of Birth" SIZE="10" onBlur="doTrim(this);"> (MM/DD/YYYY)</td></tr>
<tr><td VALIGN="top">Seating Preferences:</td>
<td>
<select NAME="SeatingPref" MULTIPLE SIZE="5">
<option VALUE="Aisle">Aisle</option>
<option VALUE="Center">Center</option>
<option VALUE="Window">Window</option>
<option VALUE="Forward">Forward</option>
<option VALUE="Rear">Rear</option>
</select>
</td>
</tr>
<tr><td VALIGN="top">Meal Preference:</td>
<td>
<input TYPE="radio" NAME="MealPref" VALUE="Standard" CHECKED> Standard
<input TYPE="radio" NAME="MealPref" VALUE="Low-Cal"> Low-Cal
<input TYPE="radio" NAME="MealPref" VALUE="Low-Salt"> Low-Salt<br>
<input TYPE="radio" NAME="MealPref" VALUE="Kosher"> Kosher
<input TYPE="radio" NAME="MealPref" VALUE="Vegetarian"> Vegetarian
</td>
</tr>
<tr><td VALIGN="top">Information Request:</td>
<td>
<input TYPE="checkbox" NAME="InfoReq" VALUE="CarRental"> Car Rental
<input TYPE="checkbox" NAME="InfoReq" VALUE="PublicTransit"> Public Transit
<input TYPE="checkbox" NAME="InfoReq" VALUE="Lodging"> Lodging<br>
<input TYPE="checkbox" NAME="InfoReq" VALUE="Attractions"> Tourist Attractions
</td>
</tr>
<tr><td>Travel Account:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="account" ID="Travel Account" SIZE="7" MAXLENGTH="6" onBlur="doTrim(this);"></td></tr>
<tr><td>Travel Account PIN:<font COLOR="#ff0000">*</font></td><td><input TYPE="password" NAME="pin" ID="Travel Account PIN" SIZE="5" MAXLENGTH="4" onBlur="doTrim(this);"></td></tr>
<tr><td VALIGN="top">Credit Card Type:<font COLOR="#ff0000">*</font></td>
<td>
<select NAME="credittype" ID="Credit Card Type">
<option VALUE="">Please select one...</option>
<option VALUE="amex">American Express</option>
<option VALUE="discover">Discover</option>
<option VALUE="mc">MasterCard</option>
<option VALUE="visa">Visa</option>
</select>
</td>
</tr>
<tr><td>Credit Card Number:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditaccount" ID="Credit Card Number" SIZE="17" MAXLENGTH="16" onBlur="doTrim(this);"> (No spaces please)</td></tr>
<tr><td>Expiration Date:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditexp" ID="Expiration Date" SIZE="6" MAXLENGTH="5" onBlur="doTrim(this);"> (MM/YY)</td></tr>
<tr><td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
</tr>
</table>
<p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
</form>
</body>
</html>
- <html>
- <head>
- <title>Example</title>
- <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
- <script LANGUAGE="JavaScript" TYPE="text/javascript">
- /* Declare global variables for the error message */
- var invalid_errors = "";
- var blank_errors = "";
- var error = "";
- /*instantiate and populate and array containing the field names for each required field. */
- var reqs = new Array();
- reqs[0] = "name";
- reqs[1] = "address";
- reqs[2] = "phone";
- reqs[3] = "state";
- reqs[4] = "zip";
- reqs[5] = "email";
- reqs[6] = "birthdate";
- reqs[7] = "account";
- reqs[8] = "pin";
- reqs[9] = "credittype";
- reqs[10] = "creditaccount";
- reqs[11] = "creditexp";
- /*
- validate required the form object as input. It depends upon two other functions:
- isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
- it returns false and cancels form submission. It also concats all errors and displays them
- in a single alert popup that designates whether a required value was omitted or whether a
- value entered was invalid.
- */
- function validate(obj){
- for(i=0;(i<reqs.length);i++){
- element = eval(obj.elements[reqs[i]]);
- if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
- else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
- }
- if(blank_errors.length != 0 || invalid_errors.length != 0){
- if(blank_errors.length != 0){ error += "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
- if(invalid_errors.length != 0){ error += "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
- alert(error);
- return false;
- }
- else{ return true; }
- }
- /*
- isBlank simply tests whether a value is blank or not.
- It returns true if the value is blank,
- It returns false if the value has ANY value. The type of value does not matter.
- isBlank requires a form element object as an argument.
- */
- isBlanke
- function isBlank(obj){
- if(obj.value == ""){ return true; }
- else{ return false; }
- }
- /*
- doTrim simply chomps whitespace from boths sides of a value.
- It will leave whitespace inside of the input string alone.
- doTrim is not depenedant on any other function and requires
- a form object as an arguement. It also requires that the array
- of required elements be instantiated.
- */
- function doTrim(obj){
- if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
- obj.value = obj.value.replace(/^\s+/g,"");
- obj.value = obj.value.replace(/\s+$/g,"");
- return true;
- }
- /*
- isInvalid tests whether values pass various validity checks, based on the value itself.
- The function takes two arguments, one is a form element object, the other is an integer
- that should correspond an array element in the required field array. If a given field
- passes its validity test, or if the field name is not listed in the switch logic,
- the function will return false. If the string does not pass it the validity check, the function
- returns true.
- */
- function isInvalid(obj,item){
- switch(reqs[item]) {
- case "name": if(!obj.value.match(/[a-zA-Z ]+/)){ obj.value = ""; return true; }
- break;
- case "phone": if(!obj.value.match(/[\d]{3}-[\d]{3}-[\d]{4}/)){ obj.value = ""; return true; }
- break;
- case "state": if(!obj.value.match(/[A-Z]{2}/)){ obj.value = ""; return true; }
- break;
- case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
- break;
- case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
- break;
- case "birthdate": if(!obj.value.match(/[\d]{2}\/[\d]{2}\/[\d]{4}/)){ obj.value = ""; return true; }
- break;
- case "pin": if(!obj.value.match(/[\d]{4}/)){ obj.value = ""; return true; }
- break;
- case "account": if(!obj.value.match(/[\d]{6}/)){ obj.value = ""; return true; }
- break;
- case "creditaccount": if(!obj.value.match(/[\d]{12}|[\d]{16}/)){ obj.value = ""; return true; }
- break;
- case "creditexp": if(!obj.value.match(/[\d]{2}\/[\d]{2}/)){ obj.value = ""; return true; }
- break;
- default: return false;
- }
- return false;
- }
- </script>
- </head>
- <form NAME="form1" ACTION="form.html" METHOD="post" onSubmit="return validate(this);">
- <table border="1" ALIGN="center" bgCOLOR="#cccccc">
- <tr><td>Name:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="name" ID="Name" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="address" ID="Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>City:</td><td><input TYPE="text" NAME="city" ID="City" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>State:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="state" ID="State" SIZE="3" MAXLENGTH="2" onBlur="doTrim(this);"></td></tr>
- <tr><td>ZIP:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="zip" ID="ZIP" SIZE="11" MAXLENGTH="10" onBlur="doTrim(this);"></td></tr>
- <tr><td>Phone:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="phone" ID="Phone" SIZE="13" MAXLENGTH="12" onBlur="doTrim(this);"> (555-555-5555)</td></tr>
- <tr><td>E-Mail Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>Date of Birth:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="birthdate" ID="Date of Birth" SIZE="10" onBlur="doTrim(this);"> (MM/DD/YYYY)</td></tr>
- <tr><td VALIGN="top">Seating Preferences:</td>
- <td>
- <select NAME="SeatingPref" MULTIPLE SIZE="5">
- <option VALUE="Aisle">Aisle</option>
- <option VALUE="Center">Center</option>
- <option VALUE="Window">Window</option>
- <option VALUE="Forward">Forward</option>
- <option VALUE="Rear">Rear</option>
- </select>
- </td>
- </tr>
- <tr><td VALIGN="top">Meal Preference:</td>
- <td>
- <input TYPE="radio" NAME="MealPref" VALUE="Standard" CHECKED> Standard
- <input TYPE="radio" NAME="MealPref" VALUE="Low-Cal"> Low-Cal
- <input TYPE="radio" NAME="MealPref" VALUE="Low-Salt"> Low-Salt<br>
- <input TYPE="radio" NAME="MealPref" VALUE="Kosher"> Kosher
- <input TYPE="radio" NAME="MealPref" VALUE="Vegetarian"> Vegetarian
- </td>
- </tr>
- <tr><td VALIGN="top">Information Request:</td>
- <td>
- <input TYPE="checkbox" NAME="InfoReq" VALUE="CarRental"> Car Rental
- <input TYPE="checkbox" NAME="InfoReq" VALUE="PublicTransit"> Public Transit
- <input TYPE="checkbox" NAME="InfoReq" VALUE="Lodging"> Lodging<br>
- <input TYPE="checkbox" NAME="InfoReq" VALUE="Attractions"> Tourist Attractions
- </td>
- </tr>
- <tr><td>Travel Account:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="account" ID="Travel Account" SIZE="7" MAXLENGTH="6" onBlur="doTrim(this);"></td></tr>
- <tr><td>Travel Account PIN:<font COLOR="#ff0000">*</font></td><td><input TYPE="password" NAME="pin" ID="Travel Account PIN" SIZE="5" MAXLENGTH="4" onBlur="doTrim(this);"></td></tr>
- <tr><td VALIGN="top">Credit Card Type:<font COLOR="#ff0000">*</font></td>
- <td>
- <select NAME="credittype" ID="Credit Card Type">
- <option VALUE="">Please select one...</option>
- <option VALUE="amex">American Express</option>
- <option VALUE="discover">Discover</option>
- <option VALUE="mc">MasterCard</option>
- <option VALUE="visa">Visa</option>
- </select>
- </td>
- </tr>
- <tr><td>Credit Card Number:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditaccount" ID="Credit Card Number" SIZE="17" MAXLENGTH="16" onBlur="doTrim(this);"> (No spaces please)</td></tr>
- <tr><td>Expiration Date:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditexp" ID="Expiration Date" SIZE="6" MAXLENGTH="5" onBlur="doTrim(this);"> (MM/YY)</td></tr>
- <tr><td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
- </tr>
- </table>
- <p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
- </form>
- </body>
- </html>
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
Here's a isNumeric JavaScript function. I've posted it before, on Ozzu, but you might find it useful:
.c
Code: [ Select ]
function isNumeric(input){
characters = "0123456789.";
response = true;
for(i=0;(i<input.length && response);i++){
if(characters.indexOf(input.charAt(i)) == -1){ response = false; }
}
return response;
}
characters = "0123456789.";
response = true;
for(i=0;(i<input.length && response);i++){
if(characters.indexOf(input.charAt(i)) == -1){ response = false; }
}
return response;
}
- function isNumeric(input){
- characters = "0123456789.";
- response = true;
- for(i=0;(i<input.length && response);i++){
- if(characters.indexOf(input.charAt(i)) == -1){ response = false; }
- }
- return response;
- }
.c
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
Oh yeah.... this would, of course, require JavaScript to be enabled. If that will post a significant problem, you should also look into editing your server-side script that processes the form submisstion.
However, most people competent enough to disable JavaScript are probably also saavy enough to realize they need to fill in an order before submitting it...
.c
However, most people competent enough to disable JavaScript are probably also saavy enough to realize they need to fill in an order before submitting it...
.c
- plumloopy
- Newbie


- Joined: Jun 11, 2004
- Posts: 5
- Status: Offline
Carnix,
Thanks for your reply, this is important.
I see much of value in your post, but I'm not sure where the solution lies. I see where it rejects blank posts and improper syntax (in what would be an appropriate way) but can this be applied to checkboxes?
It would be like requiring a user to check at LEAST one box in the "Information Request" field of your form. In my case, there are around 100 boxes but often users check none (multiple checks are allowed and okay).
Chris
Thanks for your reply, this is important.
I see much of value in your post, but I'm not sure where the solution lies. I see where it rejects blank posts and improper syntax (in what would be an appropriate way) but can this be applied to checkboxes?
It would be like requiring a user to check at LEAST one box in the "Information Request" field of your form. In my case, there are around 100 boxes but often users check none (multiple checks are allowed and okay).
Chris
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
Try this:
Code: [ Select ]
<html>
<head>
<title>Example</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<script LANGUAGE="JavaScript" TYPE="text/javascript">
/*instantiate and populate and array containing the field names for each required field. */
var reqs = new Array();
reqs[0] = "name";
reqs[1] = "address";
reqs[2] = "phone";
reqs[3] = "state";
reqs[4] = "zip";
reqs[5] = "email";
reqs[6] = "birthdate";
reqs[7] = "InfoReq";
reqs[8] = "account";
reqs[9] = "pin";
reqs[10] = "credittype";
reqs[11] = "creditaccount";
reqs[12] = "creditexp";
/*
validate required the form object as input. It depends upon two other functions:
isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
it returns false and cancels form submission. It also concats all errors and displays them
in a single alert popup that designates whether a required value was omitted or whether a
value entered was invalid.
*/
function validate(obj){
blank_errors = "";
invalid_errors = "";
error_message = ""
for(i=0;(i<reqs.length);i++){
element = eval(obj.elements[reqs[i]]);
if(obj.elements[reqs[i]].length > 0){
if(obj.elements[reqs[i]][0].type == "checkbox"){
if(!hasChecks(obj.elements[reqs[i]])){ blank_errors += " - "+obj.elements[reqs[i]][0].id+"\n"; }
}
}
else if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
}
if(blank_errors.length != 0 || invalid_errors.length != 0){
if(blank_errors.length != 0){ blank_errors = "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
if(invalid_errors.length != 0){ invalid_errors = "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
error_message = blank_errors + invalid_errors;
alert(error_message);
return false;
}
else{return true;}
}
/*
isBlank simply tests whether a value is blank or not.
It returns true if the value is blank,a
It returns false if the value has ANY value. The type of value does not matter.
isBlank requires a form element object as an argument.
*/
function isBlank(obj){
if(obj.value == ""){ return true; }
else{ return false; }
}
/*
hasChecks simply tests whether a set of checkbox items has at least one checked.
It returns true if ANY item is checked
It returns false if not items are checked
hasChecks requires a form element object that is a set of checkboxes (one box will not cause an error).
The value of the items is not important.
*/
function hasChecks(obj){
for(j=0;(j<obj.length);j++){
if(obj[j].checked){return true;}
}
return false;
}
/*
doTrim simply chomps whitespace from boths sides of a value.
It will leave whitespace inside of the input string alone.
doTrim is not depenedant on any other function and requires
a form object as an arguement. It also requires that the array
of required elements be instantiated.
*/
function doTrim(obj){
if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
obj.value = obj.value.replace(/^\s+/g,"");
obj.value = obj.value.replace(/\s+$/g,"");
return true;
}
/*
isInvalid tests whether values pass various validity checks, based on the value itself.
The function takes two arguments, one is a form element object, the other is an integer
that should correspond an array element in the required field array. If a given field
passes its validity test, or if the field name is not listed in the switch logic,
the function will return false. If the string does not pass it the validity check, the function
returns true.
*/
function isInvalid(obj,item){
switch(reqs[item]) {
case "name": if(!obj.value.match(/[a-zA-Z ]+/)){ obj.value = ""; return true; }
break;
case "phone": if(!obj.value.match(/[\d]{3}-[\d]{3}-[\d]{4}/)){ obj.value = ""; return true; }
break;
case "state": if(!obj.value.match(/[A-Z]{2}/)){ obj.value = ""; return true; }
break;
case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
break;
case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
break;
case "birthdate": if(!obj.value.match(/[\d]{2}\/[\d]{2}\/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "pin": if(!obj.value.match(/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "account": if(!obj.value.match(/[\d]{6}/)){ obj.value = ""; return true; }
break;
case "creditaccount": if(!obj.value.match(/[\d]{12}|[\d]{16}/)){ obj.value = ""; return true; }
break;
case "creditexp": if(!obj.value.match(/[\d]{2}\/[\d]{2}/)){ obj.value = ""; return true; }
break;
default: return false;
}
return false;
}
</script>
</head>
<form NAME="form1" ACTION="form.html" METHOD="post" onSubmit="return validate(this);">
<table border="1" ALIGN="center" bgCOLOR="#cccccc">
<tr><td>Name:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="name" ID="Name" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="address" ID="Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>City:</td><td><input TYPE="text" NAME="city" ID="City" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>State:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="state" ID="State" SIZE="3" MAXLENGTH="2" onBlur="doTrim(this);"></td></tr>
<tr><td>ZIP:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="zip" ID="ZIP" SIZE="11" MAXLENGTH="10" onBlur="doTrim(this);"></td></tr>
<tr><td>Phone:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="phone" ID="Phone" SIZE="13" MAXLENGTH="12" onBlur="doTrim(this);"> (555-555-5555)</td></tr>
<tr><td>E-Mail Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Date of Birth:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="birthdate" ID="Date of Birth" SIZE="10" onBlur="doTrim(this);"> (MM/DD/YYYY)</td></tr>
<tr><td VALIGN="top">Seating Preferences:</td>
<td>
<select NAME="SeatingPref" ID="Seating Preferences" SIZE="5" MULTIPLE>
<option VALUE="Aisle">Aisle</option>
<option VALUE="Center">Center</option>
<option VALUE="Window">Window</option>
<option VALUE="Forward">Forward</option>
<option VALUE="Rear">Rear</option>
</select>
</td>
</tr>
<tr><td VALIGN="top">Meal Preference:</td>
<td>
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Standard" CHECKED> Standard
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Low-Cal"> Low-Cal
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Low-Salt"> Low-Salt<br>
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Kosher"> Kosher
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Vegetarian"> Vegetarian
</td>
</tr>
<tr><td VALIGN="top">Information Request:<font COLOR="#ff0000">*</font></td>
<td>
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="CarRental"> Car Rental
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="PublicTransit"> Public Transit
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="Lodging"> Lodging<br>
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="Attractions"> Tourist Attractions
</td>
</tr>
<tr><td>Travel Account:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="account" ID="Travel Account" SIZE="7" MAXLENGTH="6" onBlur="doTrim(this);"></td></tr>
<tr><td>Travel Account PIN:<font COLOR="#ff0000">*</font></td><td><input TYPE="password" NAME="pin" ID="Travel Account PIN" SIZE="5" MAXLENGTH="4" onBlur="doTrim(this);"></td></tr>
<tr><td VALIGN="top">Credit Card Type:<font COLOR="#ff0000">*</font></td>
<td>
<select NAME="credittype" ID="Credit Card Type">
<option VALUE="">Please select one...</option>
<option VALUE="amex">American Express</option>
<option VALUE="discover">Discover</option>
<option VALUE="mc">MasterCard</option>
<option VALUE="visa">Visa</option>
</select>
</td>
</tr>
<tr><td>Credit Card Number:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditaccount" ID="Credit Card Number" SIZE="17" MAXLENGTH="16" onBlur="doTrim(this);"> (No spaces please)</td></tr>
<tr><td>Expiration Date:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditexp" ID="Expiration Date" SIZE="6" MAXLENGTH="5" onBlur="doTrim(this);"> (MM/YY)</td></tr>
<tr><td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
</tr>
</table>
<p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
</form>
</body>
</html>
<head>
<title>Example</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<script LANGUAGE="JavaScript" TYPE="text/javascript">
/*instantiate and populate and array containing the field names for each required field. */
var reqs = new Array();
reqs[0] = "name";
reqs[1] = "address";
reqs[2] = "phone";
reqs[3] = "state";
reqs[4] = "zip";
reqs[5] = "email";
reqs[6] = "birthdate";
reqs[7] = "InfoReq";
reqs[8] = "account";
reqs[9] = "pin";
reqs[10] = "credittype";
reqs[11] = "creditaccount";
reqs[12] = "creditexp";
/*
validate required the form object as input. It depends upon two other functions:
isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
it returns false and cancels form submission. It also concats all errors and displays them
in a single alert popup that designates whether a required value was omitted or whether a
value entered was invalid.
*/
function validate(obj){
blank_errors = "";
invalid_errors = "";
error_message = ""
for(i=0;(i<reqs.length);i++){
element = eval(obj.elements[reqs[i]]);
if(obj.elements[reqs[i]].length > 0){
if(obj.elements[reqs[i]][0].type == "checkbox"){
if(!hasChecks(obj.elements[reqs[i]])){ blank_errors += " - "+obj.elements[reqs[i]][0].id+"\n"; }
}
}
else if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
}
if(blank_errors.length != 0 || invalid_errors.length != 0){
if(blank_errors.length != 0){ blank_errors = "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
if(invalid_errors.length != 0){ invalid_errors = "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
error_message = blank_errors + invalid_errors;
alert(error_message);
return false;
}
else{return true;}
}
/*
isBlank simply tests whether a value is blank or not.
It returns true if the value is blank,a
It returns false if the value has ANY value. The type of value does not matter.
isBlank requires a form element object as an argument.
*/
function isBlank(obj){
if(obj.value == ""){ return true; }
else{ return false; }
}
/*
hasChecks simply tests whether a set of checkbox items has at least one checked.
It returns true if ANY item is checked
It returns false if not items are checked
hasChecks requires a form element object that is a set of checkboxes (one box will not cause an error).
The value of the items is not important.
*/
function hasChecks(obj){
for(j=0;(j<obj.length);j++){
if(obj[j].checked){return true;}
}
return false;
}
/*
doTrim simply chomps whitespace from boths sides of a value.
It will leave whitespace inside of the input string alone.
doTrim is not depenedant on any other function and requires
a form object as an arguement. It also requires that the array
of required elements be instantiated.
*/
function doTrim(obj){
if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
obj.value = obj.value.replace(/^\s+/g,"");
obj.value = obj.value.replace(/\s+$/g,"");
return true;
}
/*
isInvalid tests whether values pass various validity checks, based on the value itself.
The function takes two arguments, one is a form element object, the other is an integer
that should correspond an array element in the required field array. If a given field
passes its validity test, or if the field name is not listed in the switch logic,
the function will return false. If the string does not pass it the validity check, the function
returns true.
*/
function isInvalid(obj,item){
switch(reqs[item]) {
case "name": if(!obj.value.match(/[a-zA-Z ]+/)){ obj.value = ""; return true; }
break;
case "phone": if(!obj.value.match(/[\d]{3}-[\d]{3}-[\d]{4}/)){ obj.value = ""; return true; }
break;
case "state": if(!obj.value.match(/[A-Z]{2}/)){ obj.value = ""; return true; }
break;
case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
break;
case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
break;
case "birthdate": if(!obj.value.match(/[\d]{2}\/[\d]{2}\/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "pin": if(!obj.value.match(/[\d]{4}/)){ obj.value = ""; return true; }
break;
case "account": if(!obj.value.match(/[\d]{6}/)){ obj.value = ""; return true; }
break;
case "creditaccount": if(!obj.value.match(/[\d]{12}|[\d]{16}/)){ obj.value = ""; return true; }
break;
case "creditexp": if(!obj.value.match(/[\d]{2}\/[\d]{2}/)){ obj.value = ""; return true; }
break;
default: return false;
}
return false;
}
</script>
</head>
<form NAME="form1" ACTION="form.html" METHOD="post" onSubmit="return validate(this);">
<table border="1" ALIGN="center" bgCOLOR="#cccccc">
<tr><td>Name:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="name" ID="Name" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="address" ID="Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>City:</td><td><input TYPE="text" NAME="city" ID="City" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>State:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="state" ID="State" SIZE="3" MAXLENGTH="2" onBlur="doTrim(this);"></td></tr>
<tr><td>ZIP:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="zip" ID="ZIP" SIZE="11" MAXLENGTH="10" onBlur="doTrim(this);"></td></tr>
<tr><td>Phone:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="phone" ID="Phone" SIZE="13" MAXLENGTH="12" onBlur="doTrim(this);"> (555-555-5555)</td></tr>
<tr><td>E-Mail Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
<tr><td>Date of Birth:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="birthdate" ID="Date of Birth" SIZE="10" onBlur="doTrim(this);"> (MM/DD/YYYY)</td></tr>
<tr><td VALIGN="top">Seating Preferences:</td>
<td>
<select NAME="SeatingPref" ID="Seating Preferences" SIZE="5" MULTIPLE>
<option VALUE="Aisle">Aisle</option>
<option VALUE="Center">Center</option>
<option VALUE="Window">Window</option>
<option VALUE="Forward">Forward</option>
<option VALUE="Rear">Rear</option>
</select>
</td>
</tr>
<tr><td VALIGN="top">Meal Preference:</td>
<td>
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Standard" CHECKED> Standard
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Low-Cal"> Low-Cal
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Low-Salt"> Low-Salt<br>
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Kosher"> Kosher
<input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Vegetarian"> Vegetarian
</td>
</tr>
<tr><td VALIGN="top">Information Request:<font COLOR="#ff0000">*</font></td>
<td>
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="CarRental"> Car Rental
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="PublicTransit"> Public Transit
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="Lodging"> Lodging<br>
<input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="Attractions"> Tourist Attractions
</td>
</tr>
<tr><td>Travel Account:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="account" ID="Travel Account" SIZE="7" MAXLENGTH="6" onBlur="doTrim(this);"></td></tr>
<tr><td>Travel Account PIN:<font COLOR="#ff0000">*</font></td><td><input TYPE="password" NAME="pin" ID="Travel Account PIN" SIZE="5" MAXLENGTH="4" onBlur="doTrim(this);"></td></tr>
<tr><td VALIGN="top">Credit Card Type:<font COLOR="#ff0000">*</font></td>
<td>
<select NAME="credittype" ID="Credit Card Type">
<option VALUE="">Please select one...</option>
<option VALUE="amex">American Express</option>
<option VALUE="discover">Discover</option>
<option VALUE="mc">MasterCard</option>
<option VALUE="visa">Visa</option>
</select>
</td>
</tr>
<tr><td>Credit Card Number:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditaccount" ID="Credit Card Number" SIZE="17" MAXLENGTH="16" onBlur="doTrim(this);"> (No spaces please)</td></tr>
<tr><td>Expiration Date:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditexp" ID="Expiration Date" SIZE="6" MAXLENGTH="5" onBlur="doTrim(this);"> (MM/YY)</td></tr>
<tr><td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
</tr>
</table>
<p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
</form>
</body>
</html>
- <html>
- <head>
- <title>Example</title>
- <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
- <script LANGUAGE="JavaScript" TYPE="text/javascript">
- /*instantiate and populate and array containing the field names for each required field. */
- var reqs = new Array();
- reqs[0] = "name";
- reqs[1] = "address";
- reqs[2] = "phone";
- reqs[3] = "state";
- reqs[4] = "zip";
- reqs[5] = "email";
- reqs[6] = "birthdate";
- reqs[7] = "InfoReq";
- reqs[8] = "account";
- reqs[9] = "pin";
- reqs[10] = "credittype";
- reqs[11] = "creditaccount";
- reqs[12] = "creditexp";
- /*
- validate required the form object as input. It depends upon two other functions:
- isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
- it returns false and cancels form submission. It also concats all errors and displays them
- in a single alert popup that designates whether a required value was omitted or whether a
- value entered was invalid.
- */
- function validate(obj){
- blank_errors = "";
- invalid_errors = "";
- error_message = ""
- for(i=0;(i<reqs.length);i++){
- element = eval(obj.elements[reqs[i]]);
- if(obj.elements[reqs[i]].length > 0){
- if(obj.elements[reqs[i]][0].type == "checkbox"){
- if(!hasChecks(obj.elements[reqs[i]])){ blank_errors += " - "+obj.elements[reqs[i]][0].id+"\n"; }
- }
- }
- else if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
- else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
- }
- if(blank_errors.length != 0 || invalid_errors.length != 0){
- if(blank_errors.length != 0){ blank_errors = "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
- if(invalid_errors.length != 0){ invalid_errors = "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
- error_message = blank_errors + invalid_errors;
- alert(error_message);
- return false;
- }
- else{return true;}
- }
- /*
- isBlank simply tests whether a value is blank or not.
- It returns true if the value is blank,a
- It returns false if the value has ANY value. The type of value does not matter.
- isBlank requires a form element object as an argument.
- */
- function isBlank(obj){
- if(obj.value == ""){ return true; }
- else{ return false; }
- }
- /*
- hasChecks simply tests whether a set of checkbox items has at least one checked.
- It returns true if ANY item is checked
- It returns false if not items are checked
- hasChecks requires a form element object that is a set of checkboxes (one box will not cause an error).
- The value of the items is not important.
- */
- function hasChecks(obj){
- for(j=0;(j<obj.length);j++){
- if(obj[j].checked){return true;}
- }
- return false;
- }
- /*
- doTrim simply chomps whitespace from boths sides of a value.
- It will leave whitespace inside of the input string alone.
- doTrim is not depenedant on any other function and requires
- a form object as an arguement. It also requires that the array
- of required elements be instantiated.
- */
- function doTrim(obj){
- if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
- obj.value = obj.value.replace(/^\s+/g,"");
- obj.value = obj.value.replace(/\s+$/g,"");
- return true;
- }
- /*
- isInvalid tests whether values pass various validity checks, based on the value itself.
- The function takes two arguments, one is a form element object, the other is an integer
- that should correspond an array element in the required field array. If a given field
- passes its validity test, or if the field name is not listed in the switch logic,
- the function will return false. If the string does not pass it the validity check, the function
- returns true.
- */
- function isInvalid(obj,item){
- switch(reqs[item]) {
- case "name": if(!obj.value.match(/[a-zA-Z ]+/)){ obj.value = ""; return true; }
- break;
- case "phone": if(!obj.value.match(/[\d]{3}-[\d]{3}-[\d]{4}/)){ obj.value = ""; return true; }
- break;
- case "state": if(!obj.value.match(/[A-Z]{2}/)){ obj.value = ""; return true; }
- break;
- case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
- break;
- case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
- break;
- case "birthdate": if(!obj.value.match(/[\d]{2}\/[\d]{2}\/[\d]{4}/)){ obj.value = ""; return true; }
- break;
- case "pin": if(!obj.value.match(/[\d]{4}/)){ obj.value = ""; return true; }
- break;
- case "account": if(!obj.value.match(/[\d]{6}/)){ obj.value = ""; return true; }
- break;
- case "creditaccount": if(!obj.value.match(/[\d]{12}|[\d]{16}/)){ obj.value = ""; return true; }
- break;
- case "creditexp": if(!obj.value.match(/[\d]{2}\/[\d]{2}/)){ obj.value = ""; return true; }
- break;
- default: return false;
- }
- return false;
- }
- </script>
- </head>
- <form NAME="form1" ACTION="form.html" METHOD="post" onSubmit="return validate(this);">
- <table border="1" ALIGN="center" bgCOLOR="#cccccc">
- <tr><td>Name:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="name" ID="Name" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="address" ID="Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>City:</td><td><input TYPE="text" NAME="city" ID="City" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>State:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="state" ID="State" SIZE="3" MAXLENGTH="2" onBlur="doTrim(this);"></td></tr>
- <tr><td>ZIP:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="zip" ID="ZIP" SIZE="11" MAXLENGTH="10" onBlur="doTrim(this);"></td></tr>
- <tr><td>Phone:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="phone" ID="Phone" SIZE="13" MAXLENGTH="12" onBlur="doTrim(this);"> (555-555-5555)</td></tr>
- <tr><td>E-Mail Address:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="30" onBlur="doTrim(this);"></td></tr>
- <tr><td>Date of Birth:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="birthdate" ID="Date of Birth" SIZE="10" onBlur="doTrim(this);"> (MM/DD/YYYY)</td></tr>
- <tr><td VALIGN="top">Seating Preferences:</td>
- <td>
- <select NAME="SeatingPref" ID="Seating Preferences" SIZE="5" MULTIPLE>
- <option VALUE="Aisle">Aisle</option>
- <option VALUE="Center">Center</option>
- <option VALUE="Window">Window</option>
- <option VALUE="Forward">Forward</option>
- <option VALUE="Rear">Rear</option>
- </select>
- </td>
- </tr>
- <tr><td VALIGN="top">Meal Preference:</td>
- <td>
- <input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Standard" CHECKED> Standard
- <input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Low-Cal"> Low-Cal
- <input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Low-Salt"> Low-Salt<br>
- <input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Kosher"> Kosher
- <input TYPE="radio" NAME="MealPref" ID="Meal Preference" VALUE="Vegetarian"> Vegetarian
- </td>
- </tr>
- <tr><td VALIGN="top">Information Request:<font COLOR="#ff0000">*</font></td>
- <td>
- <input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="CarRental"> Car Rental
- <input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="PublicTransit"> Public Transit
- <input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="Lodging"> Lodging<br>
- <input TYPE="checkbox" NAME="InfoReq" ID="Information Request" VALUE="Attractions"> Tourist Attractions
- </td>
- </tr>
- <tr><td>Travel Account:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="account" ID="Travel Account" SIZE="7" MAXLENGTH="6" onBlur="doTrim(this);"></td></tr>
- <tr><td>Travel Account PIN:<font COLOR="#ff0000">*</font></td><td><input TYPE="password" NAME="pin" ID="Travel Account PIN" SIZE="5" MAXLENGTH="4" onBlur="doTrim(this);"></td></tr>
- <tr><td VALIGN="top">Credit Card Type:<font COLOR="#ff0000">*</font></td>
- <td>
- <select NAME="credittype" ID="Credit Card Type">
- <option VALUE="">Please select one...</option>
- <option VALUE="amex">American Express</option>
- <option VALUE="discover">Discover</option>
- <option VALUE="mc">MasterCard</option>
- <option VALUE="visa">Visa</option>
- </select>
- </td>
- </tr>
- <tr><td>Credit Card Number:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditaccount" ID="Credit Card Number" SIZE="17" MAXLENGTH="16" onBlur="doTrim(this);"> (No spaces please)</td></tr>
- <tr><td>Expiration Date:<font COLOR="#ff0000">*</font></td><td><input TYPE="text" NAME="creditexp" ID="Expiration Date" SIZE="6" MAXLENGTH="5" onBlur="doTrim(this);"> (MM/YY)</td></tr>
- <tr><td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
- </tr>
- </table>
- <p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
- </form>
- </body>
- </html>
- plumloopy
- Newbie


- Joined: Jun 11, 2004
- Posts: 5
- Status: Offline
Thanks so much for your help! I'm definitely getting it to reject empty requests but now I'm having trouble getting it to communicate with the old formmail program. To be sure, a lesser problem but the old formmail inserted a subject and header into the email, which is helpful. I've tried countless variations to basically preserve the previous behavior while still utilizing your helpful java code, but the two don't seem to work together.
Here's my code thus far (minus most of the books):
Here's my code thus far (minus most of the books):
Code: [ Select ]
<html>
<head>
<title>Roxbury Examination Copy Order</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<script LANGUAGE="JavaScript" TYPE="text/javascript">
/*instantiate and populate and array containing the field names for each required field. */
var reqs = new Array();
reqs[0] = "name";
reqs[1] = "Institution";
reqs[2] = "Department";
reqs[3] = "address";
reqs[4] = "state";
reqs[5] = "zip";
reqs[6] = "phone";
reqs[7] = "email";
reqs[8] = "adoptiondecisiondeadline";
reqs[9] = "book";
reqs[10] = "likelihoodoftextchange";
/*
validate required the form object as input. It depends upon two other functions:
isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
it returns false and cancels form submission. It also concats all errors and displays them
in a single alert popup that designates whether a required value was omitted or whether a
value entered was invalid.
*/
function validate(obj){
blank_errors = "";
invalid_errors = "";
error_message = ""
for(i=0;(i<reqs.length);i++){
element = eval(obj.elements[reqs[i]]);
if(obj.elements[reqs[i]].length > 0){
if(obj.elements[reqs[i]][0].type == "checkbox"){
if(!hasChecks(obj.elements[reqs[i]])){ blank_errors += " - "+obj.elements[reqs[i]][0].id+"\n"; }
}
}
else if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
}
if(blank_errors.length != 0 || invalid_errors.length != 0){
if(blank_errors.length != 0){ blank_errors = "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
if(invalid_errors.length != 0){ invalid_errors = "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
error_message = blank_errors + invalid_errors;
alert(error_message);
return false;
}
else{return true;}
}
/*
isBlank simply tests whether a value is blank or not.
It returns true if the value is blank,a
It returns false if the value has ANY value. The type of value does not matter.
isBlank requires a form element object as an argument.
*/
function isBlank(obj){
if(obj.value == ""){ return true; }
else{ return false; }
}
/*
hasChecks simply tests whether a set of checkbox items has at least one checked.
It returns true if ANY item is checked
It returns false if not items are checked
hasChecks requires a form element object that is a set of checkboxes (one box will not cause an error).
The value of the items is not important.
*/
function hasChecks(obj){
for(j=0;(j<obj.length);j++){
if(obj[j].checked){return true;}
}
return false;
}
/*
doTrim simply chomps whitespace from boths sides of a value.
It will leave whitespace inside of the input string alone.
doTrim is not depenedant on any other function and requires
a form object as an arguement. It also requires that the array
of required elements be instantiated.
*/
function doTrim(obj){
if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
obj.value = obj.value.replace(/^\s+/g,"");
obj.value = obj.value.replace(/\s+$/g,"");
return true;
}
/*
isInvalid tests whether values pass various validity checks, based on the value itself.
The function takes two arguments, one is a form element object, the other is an integer
that should correspond an array element in the required field array. If a given field
passes its validity test, or if the field name is not listed in the switch logic,
the function will return false. If the string does not pass it the validity check, the function
returns true.
*/
function isInvalid(obj,item){
switch(reqs[item]) {
case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
break;
case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
break;
default: return false;
}
return false;
}
</script>
</head>
<form method="post" action="/cgi-sys/formmail.pl" onSubmit="return validate(this);">
<input name="redirect" type="hidden" value="http://www.carrierdesign.com/roxbury/thankyou.html">
<input type="hidden" name="recipient" value="contact@carrierdesign.com">
<table width="420" height="0" border="1" align="center" cellspacing="0" bordercolor="#000000" hspace="2" vspace="1">
<tbody>
<tr><td align="center" colspan="4" height="42" bgcolor="#000090">
<font face="Arial, Helvetica"><font color="#ffffff">
<font size="+1" face="Arial, Helvetica, sans-serif">ROXBURY EXAMINATION</font></font></font>
<font face="Arial, Helvetica, sans-serif"><br>
<font color="#ffffff">
<font size="+1">COPY REQUEST FORM</font></font></font></td></tr>
</tbody></table>
<table width="420" height="0" border="0" align="center" hspace="2" vspace="1">
<!--DWLayoutTable-->
<tr>
<td colspan=4> <br> <font face="Arial, Helvetica, sans-serif">Complimentary
examination copies may be requested by college and university instructors
who will seriously consider the book(s) for classroom adoption at schools
where they teach. Complimentary copies are not available to students.</font>
<p><font face="Arial, Helvetica, sans-serif">In order to receive a complimentary
copy, all information below must be completed. We can only ship complimentary
copies to an institutional address.</font></p>
<p><font face="Arial, Helvetica, sans-serif">Please enter your information
into the required fields. All required fields are marked with an asterisk.
The form cannot be processed without this information. Check "order"
next to the title(s) you're requesting. Finally, click "submit" to transmit
electronically.</font></p>
<p><font face="Arial, Helvetica, sans-serif">If you would prefer to print
out this form, please click on this page and select <b>File/Print</b>
from your browser's drop-down menu. Then fax or mail the form to us
using the contact information below.</font></p>
<p><font face="Arial, Helvetica, sans-serif">Individuals wishing to purchase
books for any other purpose should refer to the <a href="purchase.html">Roxbury
Purchase Order Form</a>.</font></p>
<p><font face="Arial, Helvetica, sans-serif"><b> <font size="-1">Roxbury
Publishing Company</font> </b><br>
<font size="-1">P.O. Box 491044</font> <br>
<font size="-1">Los Angeles, CA 90049-9044</font> <br>
<font size="-1">Tel.: (310) 473-3312</font> <br>
<font size="-1">Fax: (310) 473-4490</font></font> <font face="Arial, Helvetica, sans-serif"><br>
Email: <a href="mailto:roxbury@roxbury.net">roxbury@roxbury.net</a>
</font> </td>
</tr>
<tr>
<td width="43"><font face="Arial, Helvetica, sans-serif"> </font></td>
<td width="250"><font face="Arial, Helvetica, sans-serif"><b><font color="#d03030">*</font>
<font size="2">Name</font></b></font></td>
<td colspan="2" width="164"><input TYPE="text" NAME="name" ID="Name" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"><font face="Arial, Helvetica, sans-serif"> </font></td>
<td width="250"><font face="Arial, Helvetica, sans-serif"><b><font color="#d03030">*</font>
<font size="2">Institution</font></b></font></td>
<td colspan="2" width="164"><input type="text" NAME="Institution" ID="Institution" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font> <font face="Arial, Helvetica">
<font size="-1">Department</font></font></b></td>
<td colspan="2" width="164"> <input type="text" NAME="Department" ID="Department" SIZE="20" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font> <font face="Arial, Helvetica"><font size="-1">Street
address</font> </font></b></td>
<td colspan="2" width="164"> <input TYPE="text" NAME="address" ID="Address" SIZE="20" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
<font size="-1">City</font></font></b></td>
<td colspan="2" width="164"><input TYPE="text" NAME="city" ID="City" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
<font size="-1">State</font></font></b></td>
<td colspan="2" width="164"><input TYPE="text" NAME="state" ID="State" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
<font size="-1">Zip code</font></font></b></td>
<td colspan="2" width="164"><input type="text" name="zip" id="Zip Code" size="20" maxlength="10" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font color="#000090"><font size="-1">Your class enrollment:</font>
</font></font></b></td>
<td colspan="2" width="164"> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Fall</font></font></b></td>
<td colspan="2" width="164"><input type="text" size="20"
name="fallenrollment"> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Winter/Spring</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20"
name="winterspringenrollment"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Summer</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20"
name="summerenrollment"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="-1">Adoption decision deadline</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20" ID="Adoption Decision Deadline" name="adoptiondecisiondeadline" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="-1">Office telephone</font></font></b></td>
<td colspan="2" width="164"><input type="text" name="phone" id="Office Phone" size="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Home telephone</font></font></b></td>
<td colspan="2" width="164"><input type="text" size="20"
name="homephone"> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="-1">E-mail address</font></font></b></td>
<td colspan="2" width="164"><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="20" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font> <font
face="Arial, Helvetica"><font size="-1">Would you assign text as</font> </font></b><br>
<font face="Arial, Helvetica"><font size="-1"><b> <font
color="#ffffff">*</font></b>(click on one)</font></font></td>
<td colspan="2" width="164"> <input type="checkbox"
name="assigntextasrequired" value="assigntextasrequired"> <font
face="Arial, Helvetica"><font size="-1">Required</font></font></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="174"> <input type="checkbox"
name="assigntextasrecommended" value="assigntextasrecommended"> <font
face="Arial, Helvetica"> <font size="-1">Recommended (would be stocked in bookstore)</font></font>
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="164"> <input type="checkbox"
name="recommendedbutnotinbookstore" value="recommendedbutnotinstore"> <font
face="Arial, Helvetica"> <font size="-1">Recommended but not stocked in bookstore</font>
</font></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="164"> <input type="checkbox" name="maintext"
value="maintext"> <font face="Arial, Helvetica"><font size="-1">Main text</font></font>
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="164"> <input type="checkbox"
name="supplementarytext" value="supplementarytext"> <font
face="Arial, Helvetica"> <font size="-1">Supplementary text</font></font></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="2">Likelihood of text change:</font></font></b><br>
<font face="Arial, Helvetica"><font size="2"> 1-least likely</font><br>
<font size="2" face="Arial, Helvetica"> 10-most likely</font></font></td>
<td colspan="2" width="164"> <select name="likelihoodoftextchange" ID="Likelihood of Text Change" size="1">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font> <font
face="Arial, Helvetica"> <font size="2">How did you discover the Roxbury website?</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20"
name="howdiscoverroxnet"></td>
</tr>
<tr>
</table><br>
<table width="420" border="1" align="center" cellspacing="0" bordercolor="#000090"
hspace="2" vspace="1">
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <b><font face="Arial"><font color="#ffffff"><font
size="-1">CLICK BELOW</font> </font></font></b></td>
<td colspan=2 width="357" height="42" bgcolor="#000090"><b> <font
face="Arial, Helvetica"><font color="#ffffff"> <font size="-1">CHOOSE FROM CURRENT
AND FORTHCOMING TITLES:</font> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="al3">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1"> Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="active3.html">THE ACTIVE LEARNER: SUCCESSFUL STUDY STRATEGIES, 3rd ed.</a>
</font></font></b></td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="dcj2">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="roxdictionary2.html">THE AMERICAN DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS
AND MAJOR COURT CASES, 2nd ed.</a> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="dcj3">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font
color="#009900"> <font size="+1">*</font></font></font></b><b><font
face="Arial, Helvetica"> <font size="-1"> <a href="dictionary3.html">THE AMERICAN
DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS AND MAJOR COURT CASES, 3rd ed.</a>
<br>
</font></font></b><b><font face="Arial, Helvetica"><font
color="#009900"> <font size="-1">available: Fall 2004</font></font></font></b><br>
</td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="ad4">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="amerdrug4.html">THE AMERICAN DRUG SCENE: AN ANTHOLOGY, 4th ed.</a> </font></font></b><br>
</td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="am"> <br> <b>
<font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="americanlegal.html">THE AMERICAN LEGAL SYSTEM: FOUNDATIONS, PROCESSES,
AND NORMS, 1st ed.</a> </font></font></b><br> </td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="amsg"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="americanlegal.html">STUDENT STUDY GUIDE FOR THE AMERICAN LEGAL SYSTEM:
FOUNDATIONS, PROCESSES, AND NORMS, 1st ed.</a> </font></font></b><br>
</td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="ab2"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="answer2.html">THE ANSWER book: A REFERENCE MANUAL FOR OFFICE PERSONNEL,
2nd ed.</a> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection"
value="abwbk"><br>
<b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="answer2work.html">STUDENT WORKbook FOR THE ANSWER book, 2nd ed.</a>
</font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="acc"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font
color="#009900"> <font size="+1">*</font></font><font size="-1">
<a href="apollo.html">APOLLO, CHALLENGER, COLUMBIA: THE DECLINE OF
THE SPACE PROGRAM (A STUDY IN ORGANIZATIONAL COMMUNICATION), 1st ed.</a>
</font></font></b><br>
<b><font face="Arial, Helvetica"><font color="#009900"> <font
size="-1">available: Fall 2004</font></font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="bi"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="biologycrime.html">BIOLOGY AND CRIME, 1st ed.</a> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="bc5"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="bizcomm.html">BUSINESS COMMUNICATION: CONCEPTS AND APPLICATIONS IN
AN ELECTRONIC AGE, 5th ed.</a> </font></font></b></td>
</tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="wc2"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="writingcycle2.html">THE WRITING CYCLE: A FUNDAMENTAL TEXT FOR BEGINNING
AND INTERMEDIATE WRITERS, 2nd ed.</a> </font></font></b></td>
</tr>
<tr>
<td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
</tr>
</table>
<p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
</form>
</body>
</html>
<head>
<title>Roxbury Examination Copy Order</title>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
<script LANGUAGE="JavaScript" TYPE="text/javascript">
/*instantiate and populate and array containing the field names for each required field. */
var reqs = new Array();
reqs[0] = "name";
reqs[1] = "Institution";
reqs[2] = "Department";
reqs[3] = "address";
reqs[4] = "state";
reqs[5] = "zip";
reqs[6] = "phone";
reqs[7] = "email";
reqs[8] = "adoptiondecisiondeadline";
reqs[9] = "book";
reqs[10] = "likelihoodoftextchange";
/*
validate required the form object as input. It depends upon two other functions:
isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
it returns false and cancels form submission. It also concats all errors and displays them
in a single alert popup that designates whether a required value was omitted or whether a
value entered was invalid.
*/
function validate(obj){
blank_errors = "";
invalid_errors = "";
error_message = ""
for(i=0;(i<reqs.length);i++){
element = eval(obj.elements[reqs[i]]);
if(obj.elements[reqs[i]].length > 0){
if(obj.elements[reqs[i]][0].type == "checkbox"){
if(!hasChecks(obj.elements[reqs[i]])){ blank_errors += " - "+obj.elements[reqs[i]][0].id+"\n"; }
}
}
else if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
}
if(blank_errors.length != 0 || invalid_errors.length != 0){
if(blank_errors.length != 0){ blank_errors = "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
if(invalid_errors.length != 0){ invalid_errors = "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
error_message = blank_errors + invalid_errors;
alert(error_message);
return false;
}
else{return true;}
}
/*
isBlank simply tests whether a value is blank or not.
It returns true if the value is blank,a
It returns false if the value has ANY value. The type of value does not matter.
isBlank requires a form element object as an argument.
*/
function isBlank(obj){
if(obj.value == ""){ return true; }
else{ return false; }
}
/*
hasChecks simply tests whether a set of checkbox items has at least one checked.
It returns true if ANY item is checked
It returns false if not items are checked
hasChecks requires a form element object that is a set of checkboxes (one box will not cause an error).
The value of the items is not important.
*/
function hasChecks(obj){
for(j=0;(j<obj.length);j++){
if(obj[j].checked){return true;}
}
return false;
}
/*
doTrim simply chomps whitespace from boths sides of a value.
It will leave whitespace inside of the input string alone.
doTrim is not depenedant on any other function and requires
a form object as an arguement. It also requires that the array
of required elements be instantiated.
*/
function doTrim(obj){
if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
obj.value = obj.value.replace(/^\s+/g,"");
obj.value = obj.value.replace(/\s+$/g,"");
return true;
}
/*
isInvalid tests whether values pass various validity checks, based on the value itself.
The function takes two arguments, one is a form element object, the other is an integer
that should correspond an array element in the required field array. If a given field
passes its validity test, or if the field name is not listed in the switch logic,
the function will return false. If the string does not pass it the validity check, the function
returns true.
*/
function isInvalid(obj,item){
switch(reqs[item]) {
case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
break;
case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
break;
default: return false;
}
return false;
}
</script>
</head>
<form method="post" action="/cgi-sys/formmail.pl" onSubmit="return validate(this);">
<input name="redirect" type="hidden" value="http://www.carrierdesign.com/roxbury/thankyou.html">
<input type="hidden" name="recipient" value="contact@carrierdesign.com">
<table width="420" height="0" border="1" align="center" cellspacing="0" bordercolor="#000000" hspace="2" vspace="1">
<tbody>
<tr><td align="center" colspan="4" height="42" bgcolor="#000090">
<font face="Arial, Helvetica"><font color="#ffffff">
<font size="+1" face="Arial, Helvetica, sans-serif">ROXBURY EXAMINATION</font></font></font>
<font face="Arial, Helvetica, sans-serif"><br>
<font color="#ffffff">
<font size="+1">COPY REQUEST FORM</font></font></font></td></tr>
</tbody></table>
<table width="420" height="0" border="0" align="center" hspace="2" vspace="1">
<!--DWLayoutTable-->
<tr>
<td colspan=4> <br> <font face="Arial, Helvetica, sans-serif">Complimentary
examination copies may be requested by college and university instructors
who will seriously consider the book(s) for classroom adoption at schools
where they teach. Complimentary copies are not available to students.</font>
<p><font face="Arial, Helvetica, sans-serif">In order to receive a complimentary
copy, all information below must be completed. We can only ship complimentary
copies to an institutional address.</font></p>
<p><font face="Arial, Helvetica, sans-serif">Please enter your information
into the required fields. All required fields are marked with an asterisk.
The form cannot be processed without this information. Check "order"
next to the title(s) you're requesting. Finally, click "submit" to transmit
electronically.</font></p>
<p><font face="Arial, Helvetica, sans-serif">If you would prefer to print
out this form, please click on this page and select <b>File/Print</b>
from your browser's drop-down menu. Then fax or mail the form to us
using the contact information below.</font></p>
<p><font face="Arial, Helvetica, sans-serif">Individuals wishing to purchase
books for any other purpose should refer to the <a href="purchase.html">Roxbury
Purchase Order Form</a>.</font></p>
<p><font face="Arial, Helvetica, sans-serif"><b> <font size="-1">Roxbury
Publishing Company</font> </b><br>
<font size="-1">P.O. Box 491044</font> <br>
<font size="-1">Los Angeles, CA 90049-9044</font> <br>
<font size="-1">Tel.: (310) 473-3312</font> <br>
<font size="-1">Fax: (310) 473-4490</font></font> <font face="Arial, Helvetica, sans-serif"><br>
Email: <a href="mailto:roxbury@roxbury.net">roxbury@roxbury.net</a>
</font> </td>
</tr>
<tr>
<td width="43"><font face="Arial, Helvetica, sans-serif"> </font></td>
<td width="250"><font face="Arial, Helvetica, sans-serif"><b><font color="#d03030">*</font>
<font size="2">Name</font></b></font></td>
<td colspan="2" width="164"><input TYPE="text" NAME="name" ID="Name" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"><font face="Arial, Helvetica, sans-serif"> </font></td>
<td width="250"><font face="Arial, Helvetica, sans-serif"><b><font color="#d03030">*</font>
<font size="2">Institution</font></b></font></td>
<td colspan="2" width="164"><input type="text" NAME="Institution" ID="Institution" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font> <font face="Arial, Helvetica">
<font size="-1">Department</font></font></b></td>
<td colspan="2" width="164"> <input type="text" NAME="Department" ID="Department" SIZE="20" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font> <font face="Arial, Helvetica"><font size="-1">Street
address</font> </font></b></td>
<td colspan="2" width="164"> <input TYPE="text" NAME="address" ID="Address" SIZE="20" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
<font size="-1">City</font></font></b></td>
<td colspan="2" width="164"><input TYPE="text" NAME="city" ID="City" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
<font size="-1">State</font></font></b></td>
<td colspan="2" width="164"><input TYPE="text" NAME="state" ID="State" SIZE="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"></td>
<td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
<font size="-1">Zip code</font></font></b></td>
<td colspan="2" width="164"><input type="text" name="zip" id="Zip Code" size="20" maxlength="10" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font color="#000090"><font size="-1">Your class enrollment:</font>
</font></font></b></td>
<td colspan="2" width="164"> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Fall</font></font></b></td>
<td colspan="2" width="164"><input type="text" size="20"
name="fallenrollment"> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Winter/Spring</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20"
name="winterspringenrollment"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Summer</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20"
name="summerenrollment"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="-1">Adoption decision deadline</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20" ID="Adoption Decision Deadline" name="adoptiondecisiondeadline" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="-1">Office telephone</font></font></b></td>
<td colspan="2" width="164"><input type="text" name="phone" id="Office Phone" size="20" onBlur="doTrim(this);">
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font><font
face="Arial, Helvetica"> <font size="-1">Home telephone</font></font></b></td>
<td colspan="2" width="164"><input type="text" size="20"
name="homephone"> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="-1">E-mail address</font></font></b></td>
<td colspan="2" width="164"><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="20" onBlur="doTrim(this);"></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font> <font
face="Arial, Helvetica"><font size="-1">Would you assign text as</font> </font></b><br>
<font face="Arial, Helvetica"><font size="-1"><b> <font
color="#ffffff">*</font></b>(click on one)</font></font></td>
<td colspan="2" width="164"> <input type="checkbox"
name="assigntextasrequired" value="assigntextasrequired"> <font
face="Arial, Helvetica"><font size="-1">Required</font></font></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="174"> <input type="checkbox"
name="assigntextasrecommended" value="assigntextasrecommended"> <font
face="Arial, Helvetica"> <font size="-1">Recommended (would be stocked in bookstore)</font></font>
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="164"> <input type="checkbox"
name="recommendedbutnotinbookstore" value="recommendedbutnotinstore"> <font
face="Arial, Helvetica"> <font size="-1">Recommended but not stocked in bookstore</font>
</font></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="164"> <input type="checkbox" name="maintext"
value="maintext"> <font face="Arial, Helvetica"><font size="-1">Main text</font></font>
</td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><br> </td>
<td colspan="2" width="164"> <input type="checkbox"
name="supplementarytext" value="supplementarytext"> <font
face="Arial, Helvetica"> <font size="-1">Supplementary text</font></font></td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#d03030">*</font><font
face="Arial, Helvetica"> <font size="2">Likelihood of text change:</font></font></b><br>
<font face="Arial, Helvetica"><font size="2"> 1-least likely</font><br>
<font size="2" face="Arial, Helvetica"> 10-most likely</font></font></td>
<td colspan="2" width="164"> <select name="likelihoodoftextchange" ID="Likelihood of Text Change" size="1">
<option></option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select> </td>
</tr>
<tr>
<td width="43"><br> </td>
<td width="250"><b><font color="#ffffff">*</font> <font
face="Arial, Helvetica"> <font size="2">How did you discover the Roxbury website?</font></font></b></td>
<td colspan="2" width="164"> <input type="text" size="20"
name="howdiscoverroxnet"></td>
</tr>
<tr>
</table><br>
<table width="420" border="1" align="center" cellspacing="0" bordercolor="#000090"
hspace="2" vspace="1">
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <b><font face="Arial"><font color="#ffffff"><font
size="-1">CLICK BELOW</font> </font></font></b></td>
<td colspan=2 width="357" height="42" bgcolor="#000090"><b> <font
face="Arial, Helvetica"><font color="#ffffff"> <font size="-1">CHOOSE FROM CURRENT
AND FORTHCOMING TITLES:</font> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="al3">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1"> Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="active3.html">THE ACTIVE LEARNER: SUCCESSFUL STUDY STRATEGIES, 3rd ed.</a>
</font></font></b></td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="dcj2">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="roxdictionary2.html">THE AMERICAN DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS
AND MAJOR COURT CASES, 2nd ed.</a> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="dcj3">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font
color="#009900"> <font size="+1">*</font></font></font></b><b><font
face="Arial, Helvetica"> <font size="-1"> <a href="dictionary3.html">THE AMERICAN
DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS AND MAJOR COURT CASES, 3rd ed.</a>
<br>
</font></font></b><b><font face="Arial, Helvetica"><font
color="#009900"> <font size="-1">available: Fall 2004</font></font></font></b><br>
</td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="ad4">
<br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="amerdrug4.html">THE AMERICAN DRUG SCENE: AN ANTHOLOGY, 4th ed.</a> </font></font></b><br>
</td>
</tr>
<tr>
<td valign="top" width="42" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="am"> <br> <b>
<font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
<a
href="americanlegal.html">THE AMERICAN LEGAL SYSTEM: FOUNDATIONS, PROCESSES,
AND NORMS, 1st ed.</a> </font></font></b><br> </td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="amsg"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="americanlegal.html">STUDENT STUDY GUIDE FOR THE AMERICAN LEGAL SYSTEM:
FOUNDATIONS, PROCESSES, AND NORMS, 1st ed.</a> </font></font></b><br>
</td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="ab2"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="answer2.html">THE ANSWER book: A REFERENCE MANUAL FOR OFFICE PERSONNEL,
2nd ed.</a> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection"
value="abwbk"><br>
<b><font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="answer2work.html">STUDENT WORKbook FOR THE ANSWER book, 2nd ed.</a>
</font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="acc"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font
color="#009900"> <font size="+1">*</font></font><font size="-1">
<a href="apollo.html">APOLLO, CHALLENGER, COLUMBIA: THE DECLINE OF
THE SPACE PROGRAM (A STUDY IN ORGANIZATIONAL COMMUNICATION), 1st ed.</a>
</font></font></b><br>
<b><font face="Arial, Helvetica"><font color="#009900"> <font
size="-1">available: Fall 2004</font></font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="bi"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="biologycrime.html">BIOLOGY AND CRIME, 1st ed.</a> </font></font></b></td>
</tr>
<tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="bc5"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="bizcomm.html">BUSINESS COMMUNICATION: CONCEPTS AND APPLICATIONS IN
AN ELECTRONIC AGE, 5th ed.</a> </font></font></b></td>
</tr>
<td valign="top" width="44" bgcolor="#000090"
bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="wc2"><br>
<b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
size="-1">Order</font></font></font></b></td>
<td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
href="writingcycle2.html">THE WRITING CYCLE: A FUNDAMENTAL TEXT FOR BEGINNING
AND INTERMEDIATE WRITERS, 2nd ed.</a> </font></font></b></td>
</tr>
<tr>
<td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
</tr>
</table>
<p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
</form>
</body>
</html>
- <html>
- <head>
- <title>Roxbury Examination Copy Order</title>
- <meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=utf-8">
- <script LANGUAGE="JavaScript" TYPE="text/javascript">
- /*instantiate and populate and array containing the field names for each required field. */
- var reqs = new Array();
- reqs[0] = "name";
- reqs[1] = "Institution";
- reqs[2] = "Department";
- reqs[3] = "address";
- reqs[4] = "state";
- reqs[5] = "zip";
- reqs[6] = "phone";
- reqs[7] = "email";
- reqs[8] = "adoptiondecisiondeadline";
- reqs[9] = "book";
- reqs[10] = "likelihoodoftextchange";
- /*
- validate required the form object as input. It depends upon two other functions:
- isBlank and isInvalid. It returns true if both isBlank and isInvalid are false, otherwise
- it returns false and cancels form submission. It also concats all errors and displays them
- in a single alert popup that designates whether a required value was omitted or whether a
- value entered was invalid.
- */
- function validate(obj){
- blank_errors = "";
- invalid_errors = "";
- error_message = ""
- for(i=0;(i<reqs.length);i++){
- element = eval(obj.elements[reqs[i]]);
- if(obj.elements[reqs[i]].length > 0){
- if(obj.elements[reqs[i]][0].type == "checkbox"){
- if(!hasChecks(obj.elements[reqs[i]])){ blank_errors += " - "+obj.elements[reqs[i]][0].id+"\n"; }
- }
- }
- else if(isBlank(element)){ blank_errors += " - "+element.id+"\n"; }
- else{ if(isInvalid(element,i)){ invalid_errors += " - "+element.id+"\n"; } }
- }
- if(blank_errors.length != 0 || invalid_errors.length != 0){
- if(blank_errors.length != 0){ blank_errors = "The following required fields are required,\nbut it appears you left them blank:\n" + blank_errors; }
- if(invalid_errors.length != 0){ invalid_errors = "\nThe following required fields contain invalid values:\n" + invalid_errors + "\nThese invalid values have been removed,\nplease re-enter them.\n"; }
- error_message = blank_errors + invalid_errors;
- alert(error_message);
- return false;
- }
- else{return true;}
- }
- /*
- isBlank simply tests whether a value is blank or not.
- It returns true if the value is blank,a
- It returns false if the value has ANY value. The type of value does not matter.
- isBlank requires a form element object as an argument.
- */
- function isBlank(obj){
- if(obj.value == ""){ return true; }
- else{ return false; }
- }
- /*
- hasChecks simply tests whether a set of checkbox items has at least one checked.
- It returns true if ANY item is checked
- It returns false if not items are checked
- hasChecks requires a form element object that is a set of checkboxes (one box will not cause an error).
- The value of the items is not important.
- */
- function hasChecks(obj){
- for(j=0;(j<obj.length);j++){
- if(obj[j].checked){return true;}
- }
- return false;
- }
- /*
- doTrim simply chomps whitespace from boths sides of a value.
- It will leave whitespace inside of the input string alone.
- doTrim is not depenedant on any other function and requires
- a form object as an arguement. It also requires that the array
- of required elements be instantiated.
- */
- function doTrim(obj){
- if(obj.name == reqs[3]){ obj.value = obj.value.toUpperCase(); }
- obj.value = obj.value.replace(/^\s+/g,"");
- obj.value = obj.value.replace(/\s+$/g,"");
- return true;
- }
- /*
- isInvalid tests whether values pass various validity checks, based on the value itself.
- The function takes two arguments, one is a form element object, the other is an integer
- that should correspond an array element in the required field array. If a given field
- passes its validity test, or if the field name is not listed in the switch logic,
- the function will return false. If the string does not pass it the validity check, the function
- returns true.
- */
- function isInvalid(obj,item){
- switch(reqs[item]) {
- case "zip": if(!obj.value.match(/(^[\d]{5}$)|(^[\d]{5}-[\d]{4}$)/)){ obj.value = ""; return true; }
- break;
- case "email": if(!obj.value.match(/[^@]+@[\S]+\.[\S]+/)){ obj.value = ""; return true; }
- break;
- default: return false;
- }
- return false;
- }
- </script>
- </head>
- <form method="post" action="/cgi-sys/formmail.pl" onSubmit="return validate(this);">
- <input name="redirect" type="hidden" value="http://www.carrierdesign.com/roxbury/thankyou.html">
- <input type="hidden" name="recipient" value="contact@carrierdesign.com">
- <table width="420" height="0" border="1" align="center" cellspacing="0" bordercolor="#000000" hspace="2" vspace="1">
- <tbody>
- <tr><td align="center" colspan="4" height="42" bgcolor="#000090">
- <font face="Arial, Helvetica"><font color="#ffffff">
- <font size="+1" face="Arial, Helvetica, sans-serif">ROXBURY EXAMINATION</font></font></font>
- <font face="Arial, Helvetica, sans-serif"><br>
- <font color="#ffffff">
- <font size="+1">COPY REQUEST FORM</font></font></font></td></tr>
- </tbody></table>
- <table width="420" height="0" border="0" align="center" hspace="2" vspace="1">
- <!--DWLayoutTable-->
- <tr>
- <td colspan=4> <br> <font face="Arial, Helvetica, sans-serif">Complimentary
- examination copies may be requested by college and university instructors
- who will seriously consider the book(s) for classroom adoption at schools
- where they teach. Complimentary copies are not available to students.</font>
- <p><font face="Arial, Helvetica, sans-serif">In order to receive a complimentary
- copy, all information below must be completed. We can only ship complimentary
- copies to an institutional address.</font></p>
- <p><font face="Arial, Helvetica, sans-serif">Please enter your information
- into the required fields. All required fields are marked with an asterisk.
- The form cannot be processed without this information. Check "order"
- next to the title(s) you're requesting. Finally, click "submit" to transmit
- electronically.</font></p>
- <p><font face="Arial, Helvetica, sans-serif">If you would prefer to print
- out this form, please click on this page and select <b>File/Print</b>
- from your browser's drop-down menu. Then fax or mail the form to us
- using the contact information below.</font></p>
- <p><font face="Arial, Helvetica, sans-serif">Individuals wishing to purchase
- books for any other purpose should refer to the <a href="purchase.html">Roxbury
- Purchase Order Form</a>.</font></p>
- <p><font face="Arial, Helvetica, sans-serif"><b> <font size="-1">Roxbury
- Publishing Company</font> </b><br>
- <font size="-1">P.O. Box 491044</font> <br>
- <font size="-1">Los Angeles, CA 90049-9044</font> <br>
- <font size="-1">Tel.: (310) 473-3312</font> <br>
- <font size="-1">Fax: (310) 473-4490</font></font> <font face="Arial, Helvetica, sans-serif"><br>
- Email: <a href="mailto:roxbury@roxbury.net">roxbury@roxbury.net</a>
- </font> </td>
- </tr>
- <tr>
- <td width="43"><font face="Arial, Helvetica, sans-serif"> </font></td>
- <td width="250"><font face="Arial, Helvetica, sans-serif"><b><font color="#d03030">*</font>
- <font size="2">Name</font></b></font></td>
- <td colspan="2" width="164"><input TYPE="text" NAME="name" ID="Name" SIZE="20" onBlur="doTrim(this);">
- </td>
- </tr>
- <tr>
- <td width="43"><font face="Arial, Helvetica, sans-serif"> </font></td>
- <td width="250"><font face="Arial, Helvetica, sans-serif"><b><font color="#d03030">*</font>
- <font size="2">Institution</font></b></font></td>
- <td colspan="2" width="164"><input type="text" NAME="Institution" ID="Institution" SIZE="20" onBlur="doTrim(this);">
- </td>
- </tr>
- <tr>
- <td width="43"></td>
- <td width="250"><b><font color="#d03030">*</font> <font face="Arial, Helvetica">
- <font size="-1">Department</font></font></b></td>
- <td colspan="2" width="164"> <input type="text" NAME="Department" ID="Department" SIZE="20" onBlur="doTrim(this);"></td>
- </tr>
- <tr>
- <td width="43"></td>
- <td width="250"><b><font color="#d03030">*</font> <font face="Arial, Helvetica"><font size="-1">Street
- address</font> </font></b></td>
- <td colspan="2" width="164"> <input TYPE="text" NAME="address" ID="Address" SIZE="20" onBlur="doTrim(this);"></td>
- </tr>
- <tr>
- <td width="43"></td>
- <td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
- <font size="-1">City</font></font></b></td>
- <td colspan="2" width="164"><input TYPE="text" NAME="city" ID="City" SIZE="20" onBlur="doTrim(this);">
- </td>
- </tr>
- <tr>
- <td width="43"></td>
- <td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
- <font size="-1">State</font></font></b></td>
- <td colspan="2" width="164"><input TYPE="text" NAME="state" ID="State" SIZE="20" onBlur="doTrim(this);">
- </td>
- </tr>
- <tr>
- <td width="43"></td>
- <td width="250"><b><font color="#d03030">*</font><font face="Arial, Helvetica">
- <font size="-1">Zip code</font></font></b></td>
- <td colspan="2" width="164"><input type="text" name="zip" id="Zip Code" size="20" maxlength="10" onBlur="doTrim(this);">
- </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#d03030">*</font><font
- face="Arial, Helvetica"> <font color="#000090"><font size="-1">Your class enrollment:</font>
- </font></font></b></td>
- <td colspan="2" width="164"> </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#ffffff">*</font><font
- face="Arial, Helvetica"> <font size="-1">Fall</font></font></b></td>
- <td colspan="2" width="164"><input type="text" size="20"
- name="fallenrollment"> </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#ffffff">*</font><font
- face="Arial, Helvetica"> <font size="-1">Winter/Spring</font></font></b></td>
- <td colspan="2" width="164"> <input type="text" size="20"
- name="winterspringenrollment"></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#ffffff">*</font><font
- face="Arial, Helvetica"> <font size="-1">Summer</font></font></b></td>
- <td colspan="2" width="164"> <input type="text" size="20"
- name="summerenrollment"></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#d03030">*</font><font
- face="Arial, Helvetica"> <font size="-1">Adoption decision deadline</font></font></b></td>
- <td colspan="2" width="164"> <input type="text" size="20" ID="Adoption Decision Deadline" name="adoptiondecisiondeadline" onBlur="doTrim(this);"></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#d03030">*</font><font
- face="Arial, Helvetica"> <font size="-1">Office telephone</font></font></b></td>
- <td colspan="2" width="164"><input type="text" name="phone" id="Office Phone" size="20" onBlur="doTrim(this);">
- </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#ffffff">*</font><font
- face="Arial, Helvetica"> <font size="-1">Home telephone</font></font></b></td>
- <td colspan="2" width="164"><input type="text" size="20"
- name="homephone"> </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#d03030">*</font><font
- face="Arial, Helvetica"> <font size="-1">E-mail address</font></font></b></td>
- <td colspan="2" width="164"><input TYPE="text" NAME="email" ID="E-Mail Address" SIZE="20" onBlur="doTrim(this);"></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#d03030">*</font> <font
- face="Arial, Helvetica"><font size="-1">Would you assign text as</font> </font></b><br>
- <font face="Arial, Helvetica"><font size="-1"><b> <font
- color="#ffffff">*</font></b>(click on one)</font></font></td>
- <td colspan="2" width="164"> <input type="checkbox"
- name="assigntextasrequired" value="assigntextasrequired"> <font
- face="Arial, Helvetica"><font size="-1">Required</font></font></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><br> </td>
- <td colspan="2" width="174"> <input type="checkbox"
- name="assigntextasrecommended" value="assigntextasrecommended"> <font
- face="Arial, Helvetica"> <font size="-1">Recommended (would be stocked in bookstore)</font></font>
- </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><br> </td>
- <td colspan="2" width="164"> <input type="checkbox"
- name="recommendedbutnotinbookstore" value="recommendedbutnotinstore"> <font
- face="Arial, Helvetica"> <font size="-1">Recommended but not stocked in bookstore</font>
- </font></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><br> </td>
- <td colspan="2" width="164"> <input type="checkbox" name="maintext"
- value="maintext"> <font face="Arial, Helvetica"><font size="-1">Main text</font></font>
- </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><br> </td>
- <td colspan="2" width="164"> <input type="checkbox"
- name="supplementarytext" value="supplementarytext"> <font
- face="Arial, Helvetica"> <font size="-1">Supplementary text</font></font></td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#d03030">*</font><font
- face="Arial, Helvetica"> <font size="2">Likelihood of text change:</font></font></b><br>
- <font face="Arial, Helvetica"><font size="2"> 1-least likely</font><br>
- <font size="2" face="Arial, Helvetica"> 10-most likely</font></font></td>
- <td colspan="2" width="164"> <select name="likelihoodoftextchange" ID="Likelihood of Text Change" size="1">
- <option></option>
- <option>1</option>
- <option>2</option>
- <option>3</option>
- <option>4</option>
- <option>5</option>
- <option>6</option>
- <option>7</option>
- <option>8</option>
- <option>9</option>
- <option>10</option>
- </select> </td>
- </tr>
- <tr>
- <td width="43"><br> </td>
- <td width="250"><b><font color="#ffffff">*</font> <font
- face="Arial, Helvetica"> <font size="2">How did you discover the Roxbury website?</font></font></b></td>
- <td colspan="2" width="164"> <input type="text" size="20"
- name="howdiscoverroxnet"></td>
- </tr>
- <tr>
- </table><br>
- <table width="420" border="1" align="center" cellspacing="0" bordercolor="#000090"
- hspace="2" vspace="1">
- <tr>
- <td valign="top" width="42" bgcolor="#000090"
- bordercolor="#FFFFFF"> <b><font face="Arial"><font color="#ffffff"><font
- size="-1">CLICK BELOW</font> </font></font></b></td>
- <td colspan=2 width="357" height="42" bgcolor="#000090"><b> <font
- face="Arial, Helvetica"><font color="#ffffff"> <font size="-1">CHOOSE FROM CURRENT
- AND FORTHCOMING TITLES:</font> </font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="42" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="al3">
- <br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1"> Order</font></font></font></b></td>
- <td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
- <a
- href="active3.html">THE ACTIVE LEARNER: SUCCESSFUL STUDY STRATEGIES, 3rd ed.</a>
- </font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="42" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="dcj2">
- <br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
- <a
- href="roxdictionary2.html">THE AMERICAN DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS
- AND MAJOR COURT CASES, 2nd ed.</a> </font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="42" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="dcj3">
- <br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td colspan=2 width="357"><b><font face="Arial, Helvetica"><font
- color="#009900"> <font size="+1">*</font></font></font></b><b><font
- face="Arial, Helvetica"> <font size="-1"> <a href="dictionary3.html">THE AMERICAN
- DICTIONARY OF CRIMINAL JUSTICE: KEY TERMS AND MAJOR COURT CASES, 3rd ed.</a>
- <br>
- </font></font></b><b><font face="Arial, Helvetica"><font
- color="#009900"> <font size="-1">available: Fall 2004</font></font></font></b><br>
- </td>
- </tr>
- <tr>
- <td valign="top" width="42" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="ad4">
- <br> <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
- <a
- href="amerdrug4.html">THE AMERICAN DRUG SCENE: AN ANTHOLOGY, 4th ed.</a> </font></font></b><br>
- </td>
- </tr>
- <tr>
- <td valign="top" width="42" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="am"> <br> <b>
- <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td colspan=2 width="357"><b><font face="Arial, Helvetica"><font size="-1">
- <a
- href="americanlegal.html">THE AMERICAN LEGAL SYSTEM: FOUNDATIONS, PROCESSES,
- AND NORMS, 1st ed.</a> </font></font></b><br> </td>
- </tr>
- <tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="amsg"><br>
- <b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
- href="americanlegal.html">STUDENT STUDY GUIDE FOR THE AMERICAN LEGAL SYSTEM:
- FOUNDATIONS, PROCESSES, AND NORMS, 1st ed.</a> </font></font></b><br>
- </td>
- </tr>
- <tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="ab2"><br>
- <b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
- href="answer2.html">THE ANSWER book: A REFERENCE MANUAL FOR OFFICE PERSONNEL,
- 2nd ed.</a> </font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection"
- value="abwbk"><br>
- <b><font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
- href="answer2work.html">STUDENT WORKbook FOR THE ANSWER book, 2nd ed.</a>
- </font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="acc"><br>
- <b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font
- color="#009900"> <font size="+1">*</font></font><font size="-1">
- <a href="apollo.html">APOLLO, CHALLENGER, COLUMBIA: THE DECLINE OF
- THE SPACE PROGRAM (A STUDY IN ORGANIZATIONAL COMMUNICATION), 1st ed.</a>
- </font></font></b><br>
- <b><font face="Arial, Helvetica"><font color="#009900"> <font
- size="-1">available: Fall 2004</font></font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="bi"><br>
- <b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
- href="biologycrime.html">BIOLOGY AND CRIME, 1st ed.</a> </font></font></b></td>
- </tr>
- <tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="bc5"><br>
- <b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
- href="bizcomm.html">BUSINESS COMMUNICATION: CONCEPTS AND APPLICATIONS IN
- AN ELECTRONIC AGE, 5th ed.</a> </font></font></b></td>
- </tr>
- <td valign="top" width="44" bgcolor="#000090"
- bordercolor="#FFFFFF"> <input type="checkbox" NAME="book" ID="Book Selection" value="wc2"><br>
- <b> <font face="Arial, Helvetica"><font color="#ffffff"> <font
- size="-1">Order</font></font></font></b></td>
- <td width="357"><b><font face="Arial, Helvetica"><font size="-1"> <a
- href="writingcycle2.html">THE WRITING CYCLE: A FUNDAMENTAL TEXT FOR BEGINNING
- AND INTERMEDIATE WRITERS, 2nd ed.</a> </font></font></b></td>
- </tr>
- <tr>
- <td COLSPAN="2" ALIGN="center"><input TYPE="submit"> <input TYPE="reset"></td>
- </tr>
- </table>
- <p ALIGN="center"><font COLOR="#ff0000">*</font> Indicates a required field</p>
- </form>
- </body>
- </html>
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
That's strange, the javascript shouldn't affect the HTTP at all. Are you sure, when you added the script, that you didn't remove any hidden fields that might have been in the form? Some mail processors use a hidden field in the HTML to hold the from and subject lines. I, personaly, think that's a terrible idea, since it leaves your mailproc open to use by a spoofer... but nevertheless...
Do you have access to the Perl file? If so, see if you can backtrack the logic and see where it's supposed to be getting the header and subject line from.
.c
Do you have access to the Perl file? If so, see if you can backtrack the logic and see where it's supposed to be getting the header and subject line from.
.c
- plumloopy
- Newbie


- Joined: Jun 11, 2004
- Posts: 5
- Status: Offline
Here's the perl code if import:
sub send_mail {
# Localize variables used in this subroutine. #
local($print_config,$key,$sort_order,$sorted_field,$env_report);
# Open The Mail Program
open(MAIL,"|$mailprog");
print MAIL "To: $Config{'recipient'}\n";
print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
# Check for Message Subject
if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
else { print MAIL "Subject: WWW Form Submission\n\n" }
print MAIL "Below is the result of your feedback form. It was submitted by\n";
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
print MAIL "-" x 75 . "\n\n";
if (@Print_Config) {
foreach $print_config (@Print_Config) {
if ($Config{$print_config}) {
print MAIL "$print_config: $Config{$print_config}\n\n";
}
}
}
This part works:
print MAIL "To: $Config{'recipient'}\n";
print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
# Check for Message Subject
if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
else { print MAIL "Subject: WWW Form Submission\n\n" }
But this part apparently doesn't:
I need that display of the name and email, because the FROM for most email programs won't display the email address also when printed.
Thanks!
Chris
Code: [ Select ]
sub send_mail {
# Localize variables used in this subroutine. #
local($print_config,$key,$sort_order,$sorted_field,$env_report);
# Open The Mail Program
open(MAIL,"|$mailprog");
print MAIL "To: $Config{'recipient'}\n";
print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
# Check for Message Subject
if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
else { print MAIL "Subject: WWW Form Submission\n\n" }
print MAIL "Below is the result of your feedback form. It was submitted by\n";
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
print MAIL "-" x 75 . "\n\n";
if (@Print_Config) {
foreach $print_config (@Print_Config) {
if ($Config{$print_config}) {
print MAIL "$print_config: $Config{$print_config}\n\n";
}
}
}
- sub send_mail {
- # Localize variables used in this subroutine. #
- local($print_config,$key,$sort_order,$sorted_field,$env_report);
- # Open The Mail Program
- open(MAIL,"|$mailprog");
- print MAIL "To: $Config{'recipient'}\n";
- print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
- # Check for Message Subject
- if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
- else { print MAIL "Subject: WWW Form Submission\n\n" }
- print MAIL "Below is the result of your feedback form. It was submitted by\n";
- print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
- print MAIL "-" x 75 . "\n\n";
- if (@Print_Config) {
- foreach $print_config (@Print_Config) {
- if ($Config{$print_config}) {
- print MAIL "$print_config: $Config{$print_config}\n\n";
- }
- }
- }
This part works:
Code: [ Select ]
print MAIL "To: $Config{'recipient'}\n";
print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
# Check for Message Subject
if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
else { print MAIL "Subject: WWW Form Submission\n\n" }
- print MAIL "To: $Config{'recipient'}\n";
- print MAIL "From: $Config{'email'} ($Config{'realname'})\n";
- # Check for Message Subject
- if ($Config{'subject'}) { print MAIL "Subject: $Config{'subject'}\n\n" }
- else { print MAIL "Subject: WWW Form Submission\n\n" }
But this part apparently doesn't:
Code: [ Select ]
print MAIL "Below is the result of your feedback form. It was submitted by\n";
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
print MAIL "-" x 75 . "\n\n";
if (@Print_Config) {
foreach $print_config (@Print_Config) {
if ($Config{$print_config}) {
print MAIL "$print_config: $Config{$print_config}\n\n";
}
}
}
print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
print MAIL "-" x 75 . "\n\n";
if (@Print_Config) {
foreach $print_config (@Print_Config) {
if ($Config{$print_config}) {
print MAIL "$print_config: $Config{$print_config}\n\n";
}
}
}
- print MAIL "Below is the result of your feedback form. It was submitted by\n";
- print MAIL "$Config{'realname'} ($Config{'email'}) on $date\n";
- print MAIL "-" x 75 . "\n\n";
- if (@Print_Config) {
- foreach $print_config (@Print_Config) {
- if ($Config{$print_config}) {
- print MAIL "$print_config: $Config{$print_config}\n\n";
- }
- }
- }
I need that display of the name and email, because the FROM for most email programs won't display the email address also when printed.
Thanks!
Chris
- Carnix
- Guru


- Joined: Apr 28, 2004
- Posts: 1099
- Status: Offline
What is $Config{'subject'}? That looks like a hash array, but I don't see it being populated anywhere. Is there any more to this Perl? Maybe a use statement that imports another module perhaps (would be at the top, probably just below the shebang line.
Anyway, the value of "subject" and "realname" are not defined anywhere in your HTML file. Try adding a hidden field named "subject" with a value of whatever you want your email subject to be. Then, change the Name field name to "realname" (change it in the HTML and in the JavaScript array).
See if that works.
.c
Anyway, the value of "subject" and "realname" are not defined anywhere in your HTML file. Try adding a hidden field named "subject" with a value of whatever you want your email subject to be. Then, change the Name field name to "realname" (change it in the HTML and in the JavaScript array).
See if that works.
.c
Page 1 of 1
To Reply to this topic you need to LOGIN or REGISTER. It is free.
Post Information
- Total Posts in this topic: 11 posts
- Users browsing this forum: No registered users and 128 guests
- You cannot post new topics in this forum
- You cannot reply to topics in this forum
- You cannot edit your posts in this forum
- You cannot delete your posts in this forum
- You cannot post attachments in this forum
