problems with dynamic forms

B

brian.newman

I'm trying to use a layer inside a form to hide/reveal a part of the
form, but my code doesn't seem to be working and I need some help
debugging it.

I'm not getting an error which has made it difficult to debug the code,
but I am getting the alert ("break 4 in getStyleObject"); which makes
me think this is a browser compatability issue (I'm running IE 6.0).
Anyway, the code follows
function getStyleObject (objectId) {
alert ("begin getSyleObject");
if (document.getElementById && document.getElementById(objectId)) {
alert ("break 1 in getStyleObject");
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId)) {
alert ("break 2 in getStyleObject");
return document.all(objectId).style;
}
else if (document.layers && document.layers[objectId]) {
alert ("break 3 in getStyleObject");
return document.layers[objectId];
}
else {
alert ("break 4 in getStyleObject");
return false;
}
alert ("end getSyleObject");
}
function suspendSpouse(objectId) {
alert ("begin suspendSpouse");
var styleObject = getStyleObject (objectId);
alert ("break 1 in suspendSpouse");
if (styleObject) {
styleObject.visibility = "hidden";
alert ("break 2 in suspendSpouse");
return true;
}
else {
alert ("break 3 in suspendSpouse");
return false;
}
alert ("end suspendSpouse");
}

function resumeSpouse (objectId) {
alert ("check yes");
alert ("begin resumeSpouse");
var styleObject = getStyleObject (objectId);
alert ("break 1 in resumeSpouse");
if (styleObject) {
styleObject.visibility = "visible";
return true;
}
else {
return false;
}
alert ("end suspendSpouse");
}
and the significant part of the form follows
<tr>
<td class="question">Check if Spouse will come:</td>
<td><input type="radio" name="Spouse_Attend" value="Yes"
onClick="resumeSpouse(spouseLayer);">
Yes
<input type="radio" name="Spouse_Attend" value="No"
onClick="suspendSpouse(spouseLayer);">
No
</td>
</tr>
<div id="spouseLayer" style="position:relative; ">
<tr>
<td class="question">Spouse's First Name:</td>
<td><input type="text" name="Spouse_First_Name"
maxlength="30"></td>
</tr>
<tr>
<td class="question">Spouse's Last Name:</td>
<td><input type="text" name="Spouse_Last_Name"
maxlength="30"></td>
</tr>
<tr>
<td class="question">Spouse's Contact Email</td>
<td><input type="text" name="Spouse_email" maxlength="70"></td>
</tr>
<tr>
<td class="question">Spouse will require a vegetarian meal:</td>
<td><input type="radio" name="Spouse_meal_veggie" value="Yes">
Yes
<input type="radio" name="Spouse_meal_veggie" value="No">
No
</td>
</tr>
</div>
 
L

Lee

(e-mail address removed) said:
I'm trying to use a layer inside a form to hide/reveal a part of the
form, but my code doesn't seem to be working and I need some help
debugging it.

I'm not getting an error which has made it difficult to debug the code,
but I am getting the alert ("break 4 in getStyleObject"); which makes
me think this is a browser compatability issue (I'm running IE 6.0).
Anyway, the code follows

Your code would be MUCH easier to read if you used any of
the standard indentation schemes.

function getStyleObject (objectId) {
onClick="resumeSpouse(spouseLayer);">

Your code is expecting an objectId that can be passed to
getElementById, but you're passing a global reference to the div,
instead. Put single quotes around 'spouseLayer' (in both onclick
handlers).
 
B

BMR

I'm just having problems with IE style property ;-) It works fine with
Firefox. Which has a good debugger, you should try it to find out
where's the problem.
Anyway it's "document.all[objectId]" with brackets. But your problem is
not there. Are you sure about objectId ? Or does it exist while you call
getStyleObject() ?

BMR

(e-mail address removed) a écrit :
I'm trying to use a layer inside a form to hide/reveal a part of the
form, but my code doesn't seem to be working and I need some help
debugging it.

I'm not getting an error which has made it difficult to debug the code,
but I am getting the alert ("break 4 in getStyleObject"); which makes
me think this is a browser compatability issue (I'm running IE 6.0).
Anyway, the code follows
function getStyleObject (objectId) {
alert ("begin getSyleObject");
if (document.getElementById && document.getElementById(objectId)) {
alert ("break 1 in getStyleObject");
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId)) {
alert ("break 2 in getStyleObject");
return document.all(objectId).style;
}
else if (document.layers && document.layers[objectId]) {
alert ("break 3 in getStyleObject");
return document.layers[objectId];
}
else {
alert ("break 4 in getStyleObject");
return false;
}
alert ("end getSyleObject");
}
function suspendSpouse(objectId) {
alert ("begin suspendSpouse");
var styleObject = getStyleObject (objectId);
alert ("break 1 in suspendSpouse");
if (styleObject) {
styleObject.visibility = "hidden";
alert ("break 2 in suspendSpouse");
return true;
}
else {
alert ("break 3 in suspendSpouse");
return false;
}
alert ("end suspendSpouse");
}

function resumeSpouse (objectId) {
alert ("check yes");
alert ("begin resumeSpouse");
var styleObject = getStyleObject (objectId);
alert ("break 1 in resumeSpouse");
if (styleObject) {
styleObject.visibility = "visible";
return true;
}
else {
return false;
}
alert ("end suspendSpouse");
}
and the significant part of the form follows
<tr>
<td class="question">Check if Spouse will come:</td>
<td><input type="radio" name="Spouse_Attend" value="Yes"
onClick="resumeSpouse(spouseLayer);">
Yes
<input type="radio" name="Spouse_Attend" value="No"
onClick="suspendSpouse(spouseLayer);">
No
</td>
</tr>
<div id="spouseLayer" style="position:relative; ">
<tr>
<td class="question">Spouse's First Name:</td>
<td><input type="text" name="Spouse_First_Name"
maxlength="30"></td>
</tr>
<tr>
<td class="question">Spouse's Last Name:</td>
<td><input type="text" name="Spouse_Last_Name"
maxlength="30"></td>
</tr>
<tr>
<td class="question">Spouse's Contact Email</td>
<td><input type="text" name="Spouse_email" maxlength="70"></td>
</tr>
<tr>
<td class="question">Spouse will require a vegetarian meal:</td>
<td><input type="radio" name="Spouse_meal_veggie" value="Yes">
Yes
<input type="radio" name="Spouse_meal_veggie" value="No">
No
</td>
</tr>
</div>
 
B

brian.newman

I took your advice and ran it in Firefox. I got the error "spouseLayer
is not defined".
That doesn't shed much light on the problem. spouseLayer is defined as
the name of the div.
 
L

Lee

(e-mail address removed) said:
I took your advice and ran it in Firefox. I got the error "spouseLayer
is not defined".
That doesn't shed much light on the problem. spouseLayer is defined as
the name of the div.

Making "spouseLayer" the id attribute of an element doesn't define a
variable by that name.
 
M

Mick White

I'm trying to use a layer inside a form to hide/reveal a part of the
form, but my code doesn't seem to be working and I need some help
debugging it.
[snip]


<td><input type="radio" name="Spouse_Attend" value="Yes"
onClick="resumeSpouse(spouseLayer);">
Yes
<input type="radio" name="Spouse_Attend" value="No"
onClick="suspendSpouse(spouseLayer);">


....
onClick="resumeSpouse('spouseLayer');">Yes
<input type="radio" name="Spouse_Attend" value="No"
onClick="suspendSpouse('spouseLayer');">
....

The function is expecting a String, no?
Mick
 
B

brian.newman

thanks, I missed that
but now that I made that change, it still won't make the layer
disappear
 
B

brian.newman

Okay, but I cleaned up my code a little bit and am still having trouble
I guess I'm missing something really basic
Anyway, here's the current code
function suspendSpouse(objectId) {
var styleObject = document.getElementById(objectId).style;
if (styleObject) {
styleObject.visibility = "hidden";
return true;
}
else {
return false;
}
}

function resumeSpouse (objectId) {
var styleObject = document.getElementById(objectId).style;
if (styleObject) {
styleObject.visibility = "visible";
return true;
}
else {
return false;
}
}
..
..
..
<tr>
<td class="question">Check if Spouse will come:</td>
<td><input type="radio" name="Spouse_Attend" value="Yes"
onClick="resumeSpouse('spouseLayer');">
Yes
<input type="radio" name="Spouse_Attend" value="No"
onClick="suspendSpouse('spouseLayer');">
No
</td>
</tr>
 
L

Lee

(e-mail address removed) said:
Okay, but I cleaned up my code a little bit and am still having trouble
I guess I'm missing something really basic


The following works in IE and Firefox.
I didn't change the script significantly.
Since you were discarding the returned values, I removed them,
and I formatted the code so that I can read it.

My guess is that there's a problem with your HTML.


<html>
<head>
<script type="text/javascript">
function suspendSpouse(objectId) {
var styleObject = document.getElementById(objectId).style;
if (styleObject) {
styleObject.visibility = "hidden";
}
}

function resumeSpouse (objectId) {
var styleObject = document.getElementById(objectId).style;
if (styleObject) {
styleObject.visibility = "visible";
}
}
</script>
</head>
<body>
<form>
Check if Spouse will come:
<br>
<input type="radio"
name="Spouse_Attend"
value="Yes"
checked="checked"
onclick="resumeSpouse('spouseLayer');"> Yes
<br>
<input type="radio"
name="Spouse_Attend"
value="No"
onclick="suspendSpouse('spouseLayer');"> No
<br>
<div id="spouseLayer">SpouseLayer</div>
</form>
</body>
</html>
 
B

brian.newman

I used your script and the page still didn't work as hoped. So, I must
have a problem with my html.
I know I've already taken a great deal of your time, but if you don't
mind, I really need some help here.
My complete page is, now, as follows

<%@ Language=VBScript %>
<% Option Explicit %>

<!--#include file = "DatabaseConnect.asp"-->
<!--#include file = "adovbs.inc"-->

<!DOCTYPE HTML PUBLIC "-//W3C/DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Air Force Material Command Squadron Commanders' and Directors'
Course Registration Page </title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<style type="text/css">
body {
background: blue;
}
table {
width: 95%;
border: "0";
align: "center";
}
img {
width: "128";
height: "128";
align: "center";
}
h1 {
font-size: 24px;
font-weight: bold;
}
h2 {
font-size: 18px;
}
p {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
}
hr {
width: "100%";
size: = "1";
noshade;
}
td.question {
width: "279";
align: "right";
}
td.ContactInfo {
font-color:"white";
font-size:+1;
}
td.linebreak {
colspan: "2";
}

</style>
<script type="text/javascript" language="javascript">
function DisplayErrors() {
if (document.enroll.coursedate.value=="") alert ("Please enter a
coursedate");
if (document.enroll.rank.value=="") alert ("Please enter a rank");
if ((isValidName(document.enroll.firstname.value))==false) alert
("Please enter your first name");
if ((isValidName(document.enroll.middleinitial.value))==false) alert
("Please enter your middle initial");
if ((isValidName(document.enroll.lastname.value))==false) alert
("Please enter your last name");
if ((isValidDate(document.enroll.dateRank.value))==false) alert
("Please enter valid date of rank in form mm/dd/yyyy");
if (document.enroll.projected_unit.value=="") alert ("Please enter
your projected unit");
if (document.enroll.projected_base.value=="") alert ("Please enter
your projected base");
if (isValidPhone(document.enroll.projected_phone.value)==false)
alert ("Please enter a valid projected phone number in the form
xxx-xxx-xxxx");
if (isValidDate(document.enroll.Change_com_date.value)==false) alert
("Please enter a valid date for the change of command in the form
mm/dd/yyyy");
if (isValidEmail(document.enroll.Current_email.value)==false) alert
("Please enter your current email address");
if (isValidEmail(document.enroll.Transit_Email.value)==false) alert
("Please enter a valid transit email");


} // end DisplayErrors function

function ValidateForm()
{
alert ("form validation started");
var passCheck = false;
if ((document.enroll.coursedate.value!=="") &&
(document.enroll.rank.value!=="") &&
(document.enroll.firstname.value!=="") &&
(document.enroll.lastname.value!=="") &&
(isValidDate(document.enroll.rankdate.value)!==false) &&
(document.enroll.projected_unit.value!=="") &&
(document.enroll.projected_base.value!=="") &&
(isValidPhone(document.enroll.projected_phone.value)!==false) &&
(isValidDate(document.enroll.change_com_date.value)!==false) &&
(isValidEmail(document.enroll.current_email.value)!== false) &&
(isValidEmail(document.enroll.Transit_Email.value)!==false) &&
(isValidPhone(document.enroll.Transit_Phone.value)!==false) &&
(document.enroll.Current_Base.value!=="") &&
(document.enroll.Current_Unit.value!=="") &&
(isValidPhone(document.enroll.Current_DSN.value)!==false) &&
(document.enroll.Spouse_First_Name.value!=="") &&
(document.enroll.Spouse_Last_Name.value!=="") &&
(isValidEmail(document.enroll.Spouse_Email)!==false))
{
passCheck = true;
}
if (passCheck==false) DisplayErrors();
return passCheck;
} // end isFormValid function



function isValidDate (testDate) {
var invalidDate = true;
//alert ("isValidDate break 1");
if (testDate.length!==8)
{
alert ("date is not of expected length");
return false;
}
datePart = testDate.slice(0,1);
if (cint(datePart) < 1) OR (cint(datePart) > 12)
{
alert ("month is not in expected range");
return false;
}
datePart = testDate.slice (2,3);
if (cint(datePart < 1)) OR (cint(datePart) > 12)
{
alert ("day is not in expected range");
return false;
}
datePart = testDate.slice (4,7);
if (cint(datePart) < 1950) OR (cint(datePart) > 2050)
{
alert ("year is not in expected range");
return false;
}
return true;
} // end isValidDate function

function isValidName (testName) {
var myRegExp = /[A-Z][a-z]{1,29}/;
//alert (myRegExp.test(testName));
return myRegExp.test(testName);
} // end isValidName function

function isValidPhone (testPhone) {
var myRegExp = /[1-9][0-9]{2}-[0-9]{4}/;
return myRegExp.test(testPhone);

} // end isValidPhone function

function isValidEmail (testEmail) {
var myRegExp =
/[a-z0-9.]{1,40}@[a-z0-9.]{4,65}.(com|net|org|info|biz|([a-z]{2,3}.[a-z]{2}))/;
return myRegExp.test(testEmail)
} // end isValidEmail function

function getStyleObject (objectId) {
//alert ("begin getSyleObject");
//if (document.getElementById && document.getElementById(objectId))
{
//alert ("break 1 in getStyleObject");
return document.getElementById(objectId).style;
//}
//else if (document.all && document.all(objectId)) {
//alert ("break 2 in getStyleObject");
//return document.all(objectId).style;
//}
//else if (document.layers && document.layers[objectId]) {
//alert ("break 3 in getStyleObject");
//return document.layers[objectId];
//}
//else {
//alert ("break 4 in getStyleObject");
//return false;
//}
//alert ("end getSyleObject");
}
function suspendSpouse(objectId) {
//alert ("begin suspendSpouse");
//var styleObject = getStyleObject (objectId);
var styleObject = document.getElementById(objectId).style;
//alert ("break 1 in suspendSpouse");
if (styleObject) {
//alert ("styleObject.visibility = "+styleObject.visibility);
styleObject.visibility = "hidden";
//alert ("styleObject.visibility = "+styleObject.visibility);
//alert ("break 2 in suspendSpouse");
//return true;
}
//else {
//alert ("break 3 in suspendSpouse");
//return false;
//}
//alert ("end suspendSpouse");
}

function resumeSpouse (objectId) {
//alert ("check yes");
//alert ("begin resumeSpouse");
//var styleObject = getStyleObject (objectId);
var styleObject = document.getElementById(objectId).style;
//alert ("break 1 in resumeSpouse");
if (styleObject) {
styleObject.visibility = "visible";
//return true;
}
//else {
//return false;
//}
//alert ("end suspendSpouse");
}



</script>
</head>
<body>
<table>
<tr>
<td><img src="afmc.gif" alt="HQ AFMC shield"></td>
</tr>
<tr>
<td><h1>Air Force Materiel Command</h1></td>
</tr>
<tr>
<td><h1>Squadron Commanders' and Directors' Course</h1></td>
</tr>
<tr>
<td><h1>Registration Page</h1></td>
</tr>
<tr>
<td><p>(Use the &quot;TAB&quot; key or mouse button to move to the
next cell entry. &quot;ENTER&quot; key will submit registration
pre-maturely<p></td>
</tr>
<tr>
<td class="linebreak"><hr></td>
</tr>
<tr>
<td><h2>Attendee Information:</h2></td>
</tr>
<tr>
<td>
<form name="enroll" method="post" onsubmit="return ValidateForm()"
action="/sqccform/sqccform2.asp">
<table>
<tr>
<td class="question">Requested Course Date:</td>
<td><select name="coursedate">
<option value="">Select a Course Date
<option value="March 14-18">March 14-18
<option value="May 23-27">May 23-27
<option value="July 11-15">July 11-15
<option value="Aug 29-Sept 2">Aug 29-Sept 2
<option value="Sep 26-30">Sept 26-30
</select>
</td>
</tr>
<tr>
<td class="question">Select Rank/Civ Paygrade:</td>
<td><select name="rank">
<option value="">Select Rank/Civ Paygrade
<option value="Capt">Capt
<option value="Maj">Maj
<option value="LtCol">Lt Col
<option value="Col">Col
<option value="GS-12">GS-12
<option value="GS-13">GS-13
<option value="GS-14">GS-14
<option value="GS-15">GS-15
</select>
</td>
</tr>
<tr>
<td class="question">First Name:</td>
<td><input type="text" name="firstname" maxlength="30"></td>
</tr>
<tr>
<td class="question">Middle Initial:</td>
<td><input type="text" name="middleinitial" maxlength="1"></td>
</tr>
<tr>
<td class="question">Last Name:</td>
<td><input type="text" name="lastname" maxlength="30"></td>
</tr>
<tr>
<td class="question">Go By Name:</td>
<td><input type="text" name="gobyname" maxlength="30"></td>
</tr>
<tr>
<td class="question">Date of Rank:</td>
<td><input type="text" name="dateRank" maxlength="8"></td>
</tr>
<tr>
<td class="question">Projected Unit</td>
<td><select name="projected_unit">
<option value="">Select a Unit
<%
dim objRs
set objRs=Server.CreateObject("ADODB.Recordset")
objRs.Open "squadlist", objConn
do while NOT objRs.EOF
%>
<option
value="<%=objRs("squadname")%>"><%=objRs("squadname")%>
<%
objRs.MoveNext
loop
objRs.Close
set objRs = Nothing
objConn.Close
set objConn = Nothing
%>
</select>
</td>
</tr>
<tr>
<td class="question">Projected Base:</td>
<td><input type="text" name="projected_base"
maxlength="50"></td>
</tr>
<tr>
<td class="question">Projected DSN Phone:</td>
<td><input type="text" name="projected_phone"
maxlength="12"></td>
</tr>
<tr>
<td class="question">Change of Command:</td>
<td><input type="text" name="Change_com_date"
maxlength="8"></td>
</tr>
<tr>
<td class="question">Current Email Address:</td>
<td><input type="text" name="Current_email" maxlength="70"></td>
</tr>
<tr>
<td class="question">In Transit E-mail Address:</td>
<td><input type="text" name="Transit_Email" maxlength="70"></td>
</tr>
<tr>
<td class="question">In Transit Phone Number:</td>
<td><input type="text" name="Transit_Phone" maxlength="12"></td>
</tr>
<tr>
<td class="question">Current Base:</td>
<td><select name="current_base">
</select>
</td>
</tr>
<tr>
<td class="question">Current Unit:</td>
<td><input type="text" name="current_unit" maxlength="50"></td>
</tr>
<tr>
<td class="question">Current DSN Phone:</td>
<td><input type="text" name="current_dsn" maxlength="12"></td>
</tr>
<tr>
<td class="question">Vegetarian Meal Required:</td>
<td><input type="radio" name="Primary_Veggie" value="Yes">
Yes
<input type="radio" name="Primary_Veggie" value="No">
No
</td>
</tr>
<tr>
<td class="question">Check if Spouse will come:</td>
<td><input type="radio" name="Spouse_Attend" value="Yes"
onclick="resumeSpouse('spouseLayer');"> Yes
<input type="radio" name="Spouse_Attend" value="No"
checked="checked" onclick="suspendSpouse('spouseLayer');"> No
</td>
</tr>
<div id="spouseLayer">
<tr>
<td class="question">Spouse's First Name:</td>
<td><input type="text" name="Spouse_First_Name"
maxlength="30"></td>
</tr>
<tr>
<td class="question">Spouse's Last Name:</td>
<td><input type="text" name="Spouse_Last_Name"
maxlength="30"></td>
</tr>
<tr>
<td class="question">Spouse's Contact Email</td>
<td><input type="text" name="Spouse_email" maxlength="70"></td>
</tr>
<tr>
<td class="question">Spouse will require a vegetarian meal:</td>
<td><input type="radio" name="Spouse_meal_veggie" value="Yes">
Yes
<input type="radio" name="Spouse_meal_veggie" value="No">
No
</td>
</tr>
</div>
</table>
<tr>
<td class="linebreak"><hr></td>
</tr>
<table>
<tr>
<td><input type=submit value="Submit"></td>
<td><input type="reset" value="Clear Form and Start Over"></td>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td class="ContactInfo">Questions? Comments? Please call Capt. Dain
Klein at DSN: 787-2125<td>
</tr>
</table>
</body>
</html>
 
D

Dr John Stockton

JRS: In article <[email protected]>,
dated Tue, 25 Jan 2005 05:26:26, seen in (e-mail address removed) posted :
<title>Air Force Material Command Squadron Commanders' and Directors'
Course Registration Page </title>

A thoughtful and internationally-sensitive author would have indicated
which Air Force is being referred to.

<style type="text/css">

Forcing the sizes of fonts and suchlike is not considered good practice.
It is possible that you do not, in your application, need to allow for
those with sub-standard vision; but 14-point for ordinary text is too
large to suit me.
p {
font-family: "Times New Roman", Times, serif;
font-size: 14px;
}

<script type="text/javascript" language="javascript">
attribute not required
function DisplayErrors() {
if (document.enroll.coursedate.value=="") alert ("Please enter a
coursedate");

If you want your code to be readable in News, do not let your posting
agent break lines. A good craftsman chooses good tools.

if ((isValidName(document.enroll.firstname.value))==false) alert
("Please enter your first name");

... == false is not needed; use !... .

Does it matter that some people put family name first, or does your
organisation not allow that?

function ValidateForm()
{
alert ("form validation started");


Code should be indented to show intended structure; you have chosen a
badly-designed posting agent which damages readability. A good
craftsman chooses good tools.


(isValidEmail(document.enroll.Spouse_Email)!==false))

That's an interesting operator to choose.

function isValidDate (testDate) {
var invalidDate = true;
//alert ("isValidDate break 1");
if (testDate.length!==8)
{
alert ("date is not of expected length");
return false;
}
datePart = testDate.slice(0,1);
if (cint(datePart) < 1) OR (cint(datePart) > 12)
{
alert ("month is not in expected range");
return false;
}
datePart = testDate.slice (2,3);
if (cint(datePart < 1)) OR (cint(datePart) > 12)
{
alert ("day is not in expected range");
return false;
}
datePart = testDate.slice (4,7);
if (cint(datePart) < 1950) OR (cint(datePart) > 2050)
{
alert ("year is not in expected range");
return false;
}
return true;
} // end isValidDate function

Bloated; and I was going to say that it did not discriminate between
months of 28,29,30,31 days. But that pales into insignificance when one
sees that you only allow 12 days in each month.

I know what cint does in VBScript, but not of its use in javascript.

You appear to be checking an 8-digit field; but your strings call for
FFF dates, mm/dd/yyyy. Did you intend to allow a 101-year range?

Proper date validation need not be lengthy; see sig.

function isValidName (testName) {
var myRegExp = /[A-Z][a-z]{1,29}/;
//alert (myRegExp.test(testName));
return myRegExp.test(testName);
} // end isValidName function

That accepts "Ug", though it rejects "U Thant"

It accepts "Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch"
and also "llanfairpwllgwyngyllgogerychwyrndrobw1111antysiIiogogogoch".
You may not have expected that. It also accepts "00000Ol111111".
It accepts ("O'Keefe") which IIRC is the name of a NASA boss; but I
suspect that's accidental.

function isValidPhone (testPhone) {
var myRegExp = /[1-9][0-9]{2}-[0-9]{4}/;
return myRegExp.test(testPhone);

Appears to require the form ddd-dddd to be somewhere in the input.
Strings call for xxx-xxx-xxxx.
} // end isValidPhone function

function isValidEmail (testEmail) {
var myRegExp =
/[a-z0-9.]{1,40}@[a-z0-9.]{4,65}.(com|net|org|info|biz|([a-z]{2,3}.[a-z]{2}))/;
return myRegExp.test(testEmail)
} // end isValidEmail function

Rejects many valid left parts. Rejects "(e-mail address removed)", which is valid.
Accepts "##[email protected]" which may be valid but is evidently not
intended. Accepts "Joe (e-mail address removed) Brezhnev") .
function getStyleObject (objectId) {
//alert ("begin getSyleObject");
^ said:
//if (document.getElementById && document.getElementById(objectId))
{
//alert ("break 1 in getStyleObject");
return document.getElementById(objectId).style;
//}
//else if (document.all && document.all(objectId)) {
//alert ("break 2 in getStyleObject");
//return document.all(objectId).style;
//}
//else if (document.layers && document.layers[objectId]) {
//alert ("break 3 in getStyleObject");
//return document.layers[objectId];
//}
//else {
//alert ("break 4 in getStyleObject");
//return false;
//}
//alert ("end getSyleObject");
}

Does that mean that your Air Force still has Netscape 4???
function suspendSpouse(objectId) {

Seems a tactless function identifier <g>.

ISTM that your Air Force should employ a programmer to do your task.
 

Ask a Question

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

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

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top