[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 678
  • Last Modified:

Javascript issue with Internet Explorer, works fine in Firefox

I am trying to figure out this issue with IE 6.0.  I have an app that needs to change the onSubmit call on the fly.  This is the code that I have,

The document.form1.onsubmit = function() part is the part that I am having a problem with.  In Firefox, if the javascript is called, then it creates the 2 textboxes and modifies the onSubmit call.  In IE, when the javascript is called, it creates the 2 boxes and DOES NOT modify the onSubmit call.

Where am I going wrong here?

Thanks,
Drew
function getPosEndDateBox(NewPosID) {
	var OriginalPosID = document.forms.form1['OriginalPosID'].value;
	var OriginalOnSubmit = document.forms[0].onsubmit;
	if (NewPosID != OriginalPosID) {
		//The PosID was changed
		//Change OnSubmit to include Start and End Dates
		document.form1.onsubmit = function(){
			YY_checkform('form1','PosStartDate','#q','0','You must enter a Position Start Date.','PosEndDate','#q','0','You must enter a Position End Date.','FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');return document.MM_returnValue
		}
		//Show textboxes for Start and End Dates
		document.getElementById("PosStartDate").innerHTML = '<label for="PosStartDate" class="required">New Position Start Date:</label><input name="PosStartDate" id="PosStartDate" type="text" size="15" maxlength="15">';
		document.getElementById("PosEndDate").innerHTML = '<label for="PosEndDate" class="required">Old Position End Date:</label><input name="PosEndDate" id="PosEndDate" type="text" size="15" maxlength="15">';		
	} else {
		//The PosID was changed back to the original
		//Restore the original validate call
		document.form1.onsubmit = function(){
			YY_checkform('form1','FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');return document.MM_returnValue
		}
		//Remove the Start and End Date
		document.getElementById("PosStartDate").innerHTML = '';
		document.getElementById("PosEndDate").innerHTML = '';
	}
}

Open in new window

0
dr00bie
Asked:
dr00bie
  • 9
  • 8
1 Solution
 
Michel PlungjanIT ExpertCommented:
But why on the fly?
Why not just have an IF in the function called onSubmit ?

Also you create a label with input using the same ID as the fields you create
0
 
Michel PlungjanIT ExpertCommented:
Like this:

<script>
var NewPosId = "";
var OriginalPosID ="";
var testDates = false;
function validate(theForm) {
  if (testDates) YY_checkform(theForm.name,'PosStartDate','#q','0','You must enter a Position Start Date.','PosEndDate','#q','0','You must enter a Position End Date.','FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');
  else  YY_checkform(theForm.name,'FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');
  return document.MM_returnValue
}
window.onload=function() {
  OriginalPosID = NewPosId = document.forms.form1['OriginalPosID'].value;
}
function showPosDates(PosId) {
  testDates = PosId!=OriginalPosID;
  document.getElementById('datesContainer').style.display=(testDates)?'':'none'
}
function getPosEndDateBox(PosID) {
  NewPosId=PosId;
  showPosDates(PosId);
}
</script>
.
.
.
<form onSubmit="return validate(this)" name="form1">
<div id="datesContainer">
<label for="PosStartDate" class="required">New Position Start Date:</label><input name="PosStartDate" id="PosStartDate" type="text" size="15" maxlength="15">
<label for="PosEndDate" class="required">Old Position End Date:</label><input name="PosEndDate" id="PosEndDate" type="text" size="15" maxlength="15">
</div>              

Open in new window

0
 
dr00bieAuthor Commented:
I only want the Position Start Date and End Date to be displayed if the Position dropdown has been changed.

The script you provided just shows the Position Start Date and End Date from load, instead of only if a different position is selected.  I cannot have the Position Start Date and End Date on the page because if the employee's last name changes, then the user shouldn't have to enter a position start date/end date, but if the position is changed then the user should be required to enter a start and end date.

Thanks,
Drew
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
dr00bieAuthor Commented:
After messing with it a little more, I found a mispelling that was screwing it up...

This looks like it will work, although it is different than I had envisioned... I would like to modify it so that if the position is changed, the label class=required, if the position is not changed (and on load) then there is no label class (so that the label is bolded or not bolded)...

Drew
0
 
Michel PlungjanIT ExpertCommented:
Then I need to see more code, such as the code that actually calls the function when the position is changed (whatever that means)
0
 
dr00bieAuthor Commented:
Here it is...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<meta name="language" content="en">
<meta name="ROBOTS" content="ALL">
<meta NAME="keywords" CONTENT="mental retardation, Virginia, VA, MR, SWVTC, Southwestern Virginia Training Center, habilitation,intranet">
<meta name="description" content="This is the main page for the SWVTC Intranet.">
<link rel="stylesheet" type="text/css" href="http://swvtc06/swvtc/include/css/layout.css">
<link rel="stylesheet" type="text/css" href="http://swvtc06/swvtc/include/css/Forms.css">
<link rel="stylesheet" type="text/css" href="http://swvtc06/swvtc/include/css/print.css" media="print">
<title>Change Employee - Employee Core - SWVTC Intranet</title>
<script language="javascript" src="http://swvtc06/swvtc/include/jslibrary.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}
//-->
</script>
<script>
var NewPosId = "";
var OriginalPosID ="";
var testDates = false;
function validate(theForm) {
  if (testDates) YY_checkform(theForm.name,'PosStartDate','#q','0','You must enter a Position Start Date.','PosEndDate','#q','0','You must enter a Position End Date.','FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');
  else  YY_checkform(theForm.name,'FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');
  return document.MM_returnValue
}
window.onload=function() {
  OriginalPosID = NewPosId = document.forms.form1['OriginalPosID'].value;
}
function showPosDates(PosId) {
  testDates = PosId!=OriginalPosID;
  document.getElementById('datesContainer').style.display=(testDates)?'':'none'
}
function getPosEndDateBox(PosID) {
  NewPosId=PosID;
  showPosDates(PosID);
}
</script>
<noscript>
Your browser does not support JavaScript!
</noscript>
</head>
<body> 
<!--[if IE]>
	<style>
  		* HTML #holdingcell {width:expression((document.body.clientWidth<=760)?'760px':'auto');}
	</style>
<![endif]--> 
<div id="holdingcell"> 
	<div id="toplist"></div> 
	<div id="tagline"> 
		<form action="http://swvtc06/swvtc/search.asp" method="get" name="search" id="searchform"> 
			<label for="inputField" accesskey="S"> 
			<input name="Query" type="text" class="SearchBox" id="inputField" tabindex="1" onFocus="clearDefault(this)" value="Enter Keywords" size="15" maxlength="100"> 
			</label> 
			<label for="goButton" accesskey="R"> 
			<input name="search" type="image" id="goButton" tabindex="2" src="http://swvtc06/swvtc/images/submit.gif" alt="Perform Search" width="10" height="11"> 
			</label> 
		</form> 
	</div> 
</div> 
<div id="breadcrumb"><a href="http://swvtc06/swvtc/">Home</a> &gt; <a href="http://swvtc06/swvtc/database.asp">Databases</a> &gt; <a href="http://swvtc06/swvtc/DB/Emp/default.asp">Employee Databases</a> &gt; <a href="http://swvtc06/swvtc/DB/Emp/EmpCore_New/default.asp">Employee Core</a> &gt; Change Employee</div> 
<div id="fonttoolbar"><a href="#"><img src="http://swvtc06/swvtc/images/fontsizelarger.gif" alt="Increase Font Size" width="24" height="16" onClick="changeFontSize(.1,'content'); return false;"></a><a href="#"><img src="http://swvtc06/swvtc/images/fontsizesmaller.gif" alt="Decrease Font Size" width="24" height="16" onClick="changeFontSize(-.1,'content'); return false;"></a><a href="#"><img src="http://swvtc06/swvtc/images/reset.gif" alt="Reset to Default" width="29" height="16" onClick="revertStyles('content'); return false;"></a></div> 
<div id="textbar" class="sidebar"> 
	<!--#include virtual="/swvtc/include/nav.htm" --> 
	<!--#include virtual="/swvtc/include/smweather.asp" --> 
</div> 
<div id="content"> 
	<script type="text/javascript">
		setUserOptions('content');
	</script> 
	<h1>Change Employee</h1> 
	<%If varChangeCount <> 0 Then%>
	<p><a href="auditEmployee.asp?EmpID=<%=varEmpID%>">View the <%=varChangeCount & " " & varChange%> been made for this employee</a></p>
	<%End If%>
	<form action="" method="post" name="form1" class="defaultForm" onSubmit="return validate(this)"> 
		<fieldset> 
		<legend>Change Employee</legend> 
		<label for="FName" class="required">First Name:</label> 
		<input name="FName" id="FName" type="text" size="30" maxlength="50" value="<%=arrEmployee(2,0)%>"> 
		<br> 
		<label for="MName">Middle Name:</label> 
		<input name="MName" id="MName" type="text" size="30" maxlength="50" value="<%=arrEmployee(3,0)%>"> 
		<br> 
		<label for="LName" class="required">Last Name:</label> 
		<input name="LName" id="LName" type="text" size="30" maxlength="50" value="<%=arrEmployee(4,0)%>"> 
		<br> 
		<label for="Suffix">Suffix:</label> 
		<input name="Suffix" id="Suffix" type="text" size="10" maxlength="8" value="<%=arrEmployee(5,0)%>"> 
		<br> 
		<%
		Response.Write("<label for=""PosID"" class=""required"">Position #:</label><select name=""PosID"" id=""PosID"" onChange=""getPosEndDateBox(this.value);"">" & chr(10)) 
		Response.Write("<option value="""">-- Select One --</option>"& chr(10) & chr(10)) 
		'Loop through employee names and set value to selected employee
		dim ListPosition
		For ListPosition = 0 to ubound(arrPositionNotFilled, 2)
			Response.Write("<option value=""" & arrPositionNotFilled(0,ListPosition) & """")
			If CStr(arrEmployee(1,0)) = CStr(arrPositionNotFilled(0,ListPosition)) Then 
				Response.Write(" SELECTED")
			Else
				Response.Write("")
			End If	
			Response.Write(">" & arrPositionNotFilled(0,ListPosition) & " - " & arrPositionNotFilled(1,ListPosition) & "</option>" & chr(10) & chr(10))
		Next
		Response.Write("</select>")
		%>
		<br>
		<div id="datesContainer">
		<label for="PosStartDate" class="">New Position Start Date:</label><input name="PosStartDate" id="PosStartDate" type="text" size="15" maxlength="15">
		<br>
		<label for="PosEndDate" class="">Old Position End Date:</label><input name="PosEndDate" id="PosEndDate" type="text" size="15" maxlength="15">
		</div>
		<label for="StateEmpID" class="required">State Employee ID:</label> 
		<input name="StateEmpID" type="text" id="StateEmpID" size="15" maxlength="10" value="<%=arrEmployee(25,0)%>"> 
		<br>		
		<label for="SSN" class="required">Social Security Number:</label>
		<%
		dim SSN, SSN1, SSN2, SSN3
		SSN = arrEmployee(13,0)
		SSN1 = LEFT(SSN,3)
		SSN2 = MID(SSN,5,2)
		SSN3 = RIGHT(SSN,4)
		%>
		<input name="SSN1" type="text" id="SSN1" size="2" maxlength="3" value="<%=SSN1%>" onkeyup="if (this.value.length == 3) document.getElementById('SSN2').focus();">-<input name="SSN2" type="text" id="SSN2" size="1" maxlength="2" value="<%=SSN2%>" onkeyup="if (this.value.length == 2) document.getElementById('SSN3').focus();">-<input name="SSN3" type="text" id="SSN3" size="2" maxlength="4" value="<%=SSN3%>">
		<br> 
		<label for="Salary" class="required">Salary:</label> 
		<input name="Salary" id="Salary" type="text" size="15" maxlength="15" value="<%=arrEmployee(24,0)%>"> 
		<br> 
		<label for="DOB" class="required">Date of Birth:</label> 
		<input name="DOB" id="DOB" type="text" size="15" maxlength="15" value="<%=arrEmployee(12,0)%>"> 
		M/D/YYYY<br> 
		<label for="Race" class="required">Race:</label> 
		<select name="Race" id="Race">
			<option value="" <%If (Not isNull(arrEmployee(10,0))) Then If ("" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>-- Select One --</option>
			<option value="A" <%If (Not isNull(arrEmployee(10,0))) Then If ("A" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>White</option>
			<option value="B" <%If (Not isNull(arrEmployee(10,0))) Then If ("B" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Black</option>
			<option value="C" <%If (Not isNull(arrEmployee(10,0))) Then If ("C" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Hispanic</option>
			<option value="D" <%If (Not isNull(arrEmployee(10,0))) Then If ("D" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Asian/Pacific Islander</option>
			<option value="E" <%If (Not isNull(arrEmployee(10,0))) Then If ("E" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>American Indian/Alaskan Native</option>
			<option value="U" <%If (Not isNull(arrEmployee(10,0))) Then If ("U" = CStr(arrEmployee(10,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Unknown</option> 
		</select> 
		<br> 
		<label for="Sex" class="required">Sex:</label> 
		<select name="Sex" id="Sex">
			<option value="" <%If (Not isNull(arrEmployee(11,0))) Then If ("" = CStr(arrEmployee(11,0))) Then Response.Write("SELECTED") : Response.Write("")%>>-- Select One --</option>
			<option value="F" <%If (Not isNull(arrEmployee(11,0))) Then If ("F" = CStr(arrEmployee(11,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Female</option>
			<option value="M" <%If (Not isNull(arrEmployee(11,0))) Then If ("M" = CStr(arrEmployee(11,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Male</option> 
		</select> 
		<br> 
		<label for="Address" class="required">Address:</label> 
		<input name="Address" id="Address" type="text" size="30" maxlength="50" value="<%=arrEmployee(14,0)%>"> 
		<br> 
		<label for="OtherAddress">Other Address:</label> 
		<input name="OtherAddress" id="OtherAddress" type="text" size="30" maxlength="50" value="<%=arrEmployee(15,0)%>"> 
		<br> 
		<label for="City" class="required">City:</label> 
		<input name="City" id="City" type="text" size="30" maxlength="50" value="<%=arrEmployee(16,0)%>"> 
		<br> 
		<label for="State" class="required">State:</label> 
		<select name="State" id="State">
			<option value="" <%If (Not isNull(arrEmployee(17,0))) Then If ("" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>-- Select One --</option>
			<option value="AL" <%If (Not isNull(arrEmployee(17,0))) Then If ("AL" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Alabama</option>
			<option value="AK" <%If (Not isNull(arrEmployee(17,0))) Then If ("AK" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Alaska</option>
			<option value="AZ" <%If (Not isNull(arrEmployee(17,0))) Then If ("AZ" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Arizona</option>
			<option value="AR" <%If (Not isNull(arrEmployee(17,0))) Then If ("AR" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Arkansas</option>
			<option value="CA" <%If (Not isNull(arrEmployee(17,0))) Then If ("CA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>California</option>
			<option value="CO" <%If (Not isNull(arrEmployee(17,0))) Then If ("CO" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Colorado</option>
			<option value="CT" <%If (Not isNull(arrEmployee(17,0))) Then If ("CT" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Connecticut</option>
			<option value="DE" <%If (Not isNull(arrEmployee(17,0))) Then If ("DE" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Delaware</option>
			<option value="FL" <%If (Not isNull(arrEmployee(17,0))) Then If ("FL" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Florida</option>
			<option value="GA" <%If (Not isNull(arrEmployee(17,0))) Then If ("GA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Georgia</option>
			<option value="HI" <%If (Not isNull(arrEmployee(17,0))) Then If ("HI" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Hawaii</option>
			<option value="ID" <%If (Not isNull(arrEmployee(17,0))) Then If ("ID" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Idaho</option>
			<option value="IL" <%If (Not isNull(arrEmployee(17,0))) Then If ("IL" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Illinois</option>
			<option value="IN" <%If (Not isNull(arrEmployee(17,0))) Then If ("IN" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Indiana</option>
			<option value="IA" <%If (Not isNull(arrEmployee(17,0))) Then If ("IA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Iowa</option>
			<option value="KS" <%If (Not isNull(arrEmployee(17,0))) Then If ("KS" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Kansas</option>
			<option value="KY" <%If (Not isNull(arrEmployee(17,0))) Then If ("KY" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Kentucky</option>
			<option value="LA" <%If (Not isNull(arrEmployee(17,0))) Then If ("LA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Louisiana</option>
			<option value="ME" <%If (Not isNull(arrEmployee(17,0))) Then If ("ME" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Maine</option>
			<option value="MD" <%If (Not isNull(arrEmployee(17,0))) Then If ("MD" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Maryland</option>
			<option value="MA" <%If (Not isNull(arrEmployee(17,0))) Then If ("MA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Massachusetts</option>
			<option value="MI" <%If (Not isNull(arrEmployee(17,0))) Then If ("MI" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Michigan</option>
			<option value="MN" <%If (Not isNull(arrEmployee(17,0))) Then If ("MN" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Minnesota</option>
			<option value="MS" <%If (Not isNull(arrEmployee(17,0))) Then If ("MS" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Mississippi</option>
			<option value="MO" <%If (Not isNull(arrEmployee(17,0))) Then If ("MO" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Missouri</option>
			<option value="MT" <%If (Not isNull(arrEmployee(17,0))) Then If ("MT" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Montana</option>
			<option value="NE" <%If (Not isNull(arrEmployee(17,0))) Then If ("NE" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Nebraska</option>
			<option value="NV" <%If (Not isNull(arrEmployee(17,0))) Then If ("NV" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Nevada</option>
			<option value="NH" <%If (Not isNull(arrEmployee(17,0))) Then If ("NH" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>New Hampshire</option>
			<option value="NJ" <%If (Not isNull(arrEmployee(17,0))) Then If ("NJ" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>New Jersey</option>
			<option value="NM" <%If (Not isNull(arrEmployee(17,0))) Then If ("NM" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>New Mexico</option>
			<option value="NY" <%If (Not isNull(arrEmployee(17,0))) Then If ("NY" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>New York</option>
			<option value="NC" <%If (Not isNull(arrEmployee(17,0))) Then If ("NC" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>North Carolina</option>
			<option value="ND" <%If (Not isNull(arrEmployee(17,0))) Then If ("ND" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>North Dakota</option>
			<option value="OH" <%If (Not isNull(arrEmployee(17,0))) Then If ("OH" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Ohio</option>
			<option value="OK" <%If (Not isNull(arrEmployee(17,0))) Then If ("OK" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Oklahoma</option>
			<option value="OR" <%If (Not isNull(arrEmployee(17,0))) Then If ("OR" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Oregon</option>
			<option value="PA" <%If (Not isNull(arrEmployee(17,0))) Then If ("PA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Pennsylvania</option>
			<option value="RI" <%If (Not isNull(arrEmployee(17,0))) Then If ("RI" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Rhode Island</option>
			<option value="SC" <%If (Not isNull(arrEmployee(17,0))) Then If ("SC" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>South Carolina</option>
			<option value="SD" <%If (Not isNull(arrEmployee(17,0))) Then If ("SD" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>South Dakota</option>
			<option value="TN" <%If (Not isNull(arrEmployee(17,0))) Then If ("TN" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Tennessee</option>
			<option value="TX" <%If (Not isNull(arrEmployee(17,0))) Then If ("TX" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Texas</option>
			<option value="UT" <%If (Not isNull(arrEmployee(17,0))) Then If ("UT" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Utah</option>
			<option value="VT" <%If (Not isNull(arrEmployee(17,0))) Then If ("VT" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Vermont</option>
			<option value="VA" <%If (Not isNull(arrEmployee(17,0))) Then If ("VA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Virginia</option>
			<option value="WA" <%If (Not isNull(arrEmployee(17,0))) Then If ("WA" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Washington</option>
			<option value="WV" <%If (Not isNull(arrEmployee(17,0))) Then If ("WV" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>West Virginia</option>
			<option value="WI" <%If (Not isNull(arrEmployee(17,0))) Then If ("WI" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Wisconsin</option>
			<option value="WY" <%If (Not isNull(arrEmployee(17,0))) Then If ("WY" = CStr(arrEmployee(17,0))) Then Response.Write("SELECTED") : Response.Write("")%>>Wyoming</option> 
		</select> 
		<br> 
		<label for="Zip" class="required">Zip:</label> 
		<input name="Zip" id="Zip" type="text" size="15" maxlength="10" value="<%=arrEmployee(18,0)%>"> 
		<br>
		<%
		dim varSeparationDate
		If arrEmployee(21,0) = "1/1/1900" Then
			varSeparationDate = ""
		Else
			varSeparationDate = arrEmployee(21,0)
		End If
		%>
		<label for="SeparationDate">Separation Date:</label> 
		<input name="SeparationDate" id="SeparationDate" type="text" size="15" maxlength="15" value="<%=varSeparationDate%>"> 
		M/D/YYYY<br> 
		<label for="SeparationReason">Separation Reason:</label> 
		<input name="SeparationReason" id="SeparationReason" type="text" size="15" maxlength="15" value="<%=arrEmployee(23,0)%>"> 
		M/D/YYYY<br> 
		<label for="Active">Active:</label> 
		<input <%If (CStr(arrEmployee(9,0)) = CStr("True")) Then Response.Write("checked") : Response.Write("")%> name="Active" type="checkbox" id="Active" value="1">
		<br> 
		<label for="kludge"></label> 
		<input type="submit" value="Change Employee" id="submit"> 
		<input name="action" type="hidden" id="action" value="update">
		<input name="OriginalPosID" type="hidden" id="OriginalPosID" value="<%=arrEmployee(1,0)%>">		
		</fieldset> 
	</form> 
	<div id="lastmod"><span class="boldtext">This File Was Last Modified</span>:
		<!--#include virtual="/swvtc/include/lastmodified.asp" --> 
	</div> 
</div> 
</body>
</html>

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
I will look tomorrow CET
0
 
Michel PlungjanIT ExpertCommented:
Response.Write("<label id=""lblPosID"" for=""PosID"" class=""normal"">

function showPosDates(PosId) {
  testDates = PosId!=OriginalPosID;
  document.getElementById('datesContainer').style.display=(testDates)?'':'none'
  document.getElementById('lblPosID').className=(testDates)?'required':'normal'
}



0
 
dr00bieAuthor Commented:
The validation doesn't work now.  I am not sure what is going on there.

Thanks,
Drew
0
 
Michel PlungjanIT ExpertCommented:
Did you finish the

Response.Write("<label id=""lblPosID"" for=""PosID"" class=""normal"">........

Did you use the correct quotes?

can you paste the view-source or give a URL?
I do not do raw ASP
0
 
dr00bieAuthor Commented:
Here is a view source version of the code.
Here is what I want this to do.  When the position is changed, I want a Position Start Date and Position End Date textbox to be displayed and those boxes should be validated by the validate code, ie. change the validate call to include these boxes.  If the position is changed back to the original date, the position start and end date textboxes should disappear and the validate call should not require the start/end date values.

Thanks,
Drew
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1">
<meta name="language" content="en">
<meta name="ROBOTS" content="ALL">
<meta NAME="keywords" CONTENT="mental retardation, Virginia, VA, MR, SWVTC, Southwestern Virginia Training Center, habilitation,intranet">
<meta name="description" content="This is the main page for the SWVTC Intranet.">
<link rel="stylesheet" type="text/css" href="http://swvtc06/swvtc/include/css/layout.css">
<link rel="stylesheet" type="text/css" href="http://swvtc06/swvtc/include/css/Forms.css">
<link rel="stylesheet" type="text/css" href="http://swvtc06/swvtc/include/css/print.css" media="print">
<title>Change Employee - Employee Core - SWVTC Intranet</title>
<script language="javascript" src="http://swvtc06/swvtc/include/jslibrary.js"></script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
 
function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
  var a=YY_checkform.arguments,oo=true,v='',s='',err=false,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
  for (i=1; i<a.length;i=i+4){
    if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
    o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
    o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
    v=o.value;t=a[i+2];
    if (o.type=='text'||o.type=='password'||o.type=='hidden'){
      if (r&&v.length==0){err=true}
      if (v.length>0)
      if (t==1){ //fromto
        ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
      } else if (t==2){
        rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
      } else if (t==3){ // date
        ma=a[i+1].split("#");at=v.match(ma[0]);
        if(at){
          cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
          dte=new Date(cy,cm,cd);
          if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.getMonth()!=cm){err=true};
        }else{err=true}
      } else if (t==4){ // time
        ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
      } else if (t==5){ // check this 2
            if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
            if(!o1.checked){err=true}
      } else if (t==6){ // the same
            if(v!=MM_findObj(a[i+1]).value){err=true}
      }
    } else
    if (!o.type&&o.length>0&&o[0].type=='radio'){
          at = a[i].match(/(.*)\[(\d+)\].*/i);
          o2=(o.length>1)?o[at[2]]:o;
      if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
      if (t==2){
        oo=false;
        for(j=0;j<o.length;j++){oo=oo||o[j].checked}
        if(!oo){s+='* '+a[i+3]+'\n'}
      }
    } else if (o.type=='checkbox'){
      if((t==1&&o.checked==false)||(t==2&&o.checked&&o1&&o1.value.length/1==0)){err=true}
    } else if (o.type=='select-one'||o.type=='select-multiple'){
      if(t==1&&o.selectedIndex/1==0){err=true}
    }else if (o.type=='textarea'){
      if(v.length<a[i+1]){err=true}
    }
    if (err){s+='* '+a[i+3]+'\n'; err=false}
  }
  if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
  document.MM_returnValue = (s=='');
}
//-->
</script>
<script>
var NewPosId = "";
var OriginalPosID ="";
var testDates = false;
function validate(theForm) {
  if (testDates) YY_checkform(theForm.name,'PosStartDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Position Start Date in the M/D/YYYY format.','PosEndDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Position End Date in the M/D/YYYY format.','FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');
  else  YY_checkform(theForm.name,'FName','#q','0','You must enter a First Name.','LName','#q','0','You must enter a Last Name.','StateEmpID','#q','0','You must enter a State Employee ID.','SSN1','#q','0','You must enter the first part of the Social Security Number.','SSN2','#q','0','You must enter the middle part of the Social Security Number.','SSN3','#q','0','You must enter the last part of the Social Security Number.','Salary','#q','0','You must enter a Salary.','DOB','#^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter a Date of Birth in the M/D/YYYY format..','Address','#q','0','You must enter a Address.','City','#q','0','You must enter a City.','Zip','#q','0','You must enter a Zip code.','SeparationDate','^\([0-9]?[0-9]\)\/\([0-9]?[0-9]\)\/\([0-9]{4}\)$#2#1#3','3','You must enter the Separation Date in the M/D/YYYY format.','Race','#q','1','You must select a Race.','Sex','#q','1','You must select a Sex.','State','#q','1','You must select a State.');
  return document.MM_returnValue
}
window.onload=function() {
  //document.getElementById('datesContainer').style.display='none'
  OriginalPosID = NewPosId = document.forms.form1['OriginalPosID'].value;
}
function showPosDates(PosId) {
  testDates = PosId!=OriginalPosID;
  document.getElementById('datesContainer').style.display=(testDates)?'':'none'
}
function getPosEndDateBox(PosID) {
  NewPosId=PosID;
  showPosDates(PosID);
}
</script>
<noscript>
Your browser does not support JavaScript!
</noscript>
</head>
<body> 
<!--[if IE]>
	<style>
  		* HTML #holdingcell {width:expression((document.body.clientWidth<=760)?'760px':'auto');}
	</style>
<![endif]--> 
<div id="holdingcell"> 
	<div id="toplist"></div> 
	<div id="tagline"> 
		<form action="http://swvtc06/swvtc/search.asp" method="get" name="search" id="searchform"> 
			<label for="inputField" accesskey="S"> 
			<input name="Query" type="text" class="SearchBox" id="inputField" tabindex="1" onFocus="clearDefault(this)" value="Enter Keywords" size="15" maxlength="100"> 
			</label> 
			<label for="goButton" accesskey="R"> 
			<input name="search" type="image" id="goButton" tabindex="2" src="http://swvtc06/swvtc/images/submit.gif" alt="Perform Search" width="10" height="11"> 
			</label> 
		</form> 
	</div> 
</div> 
<div id="breadcrumb"><a href="http://swvtc06/swvtc/">Home</a> &gt; <a href="http://swvtc06/swvtc/database.asp">Databases</a> &gt; <a href="http://swvtc06/swvtc/DB/Emp/default.asp">Employee Databases</a> &gt; <a href="http://swvtc06/swvtc/DB/Emp/EmpCore_New/default.asp">Employee Core</a> &gt; Change Employee</div> 
<div id="fonttoolbar"><a href="#"><img src="http://swvtc06/swvtc/images/fontsizelarger.gif" alt="Increase Font Size" width="24" height="16" onClick="changeFontSize(.1,'content'); return false;"></a><a href="#"><img src="http://swvtc06/swvtc/images/fontsizesmaller.gif" alt="Decrease Font Size" width="24" height="16" onClick="changeFontSize(-.1,'content'); return false;"></a><a href="#"><img src="http://swvtc06/swvtc/images/reset.gif" alt="Reset to Default" width="29" height="16" onClick="revertStyles('content'); return false;"></a></div> 
<div id="textbar" class="sidebar"> 
	<ul>
	<li><a href="file://///Swvtc08/public/" class="nav">Public Folder</a></li>
	<li><a href="http://swvtc06/swvtc/departments.asp" class="nav">Departments</a></li>
	<li><a href="http://swvtc06/swvtc/policies.asp" class="nav">Policies</a></li>
	<li><a href="http://swvtc06/swvtc/database.asp" class="nav">Databases</a></li>
	<li><a href="http://swvtc06/swvtc/contacts.asp" class="nav">Contacts</a></li>
	<li><a href="http://swvtc06/swvtc/schedules.asp" class="nav">Schedules</a></li>
	<li><a href="http://swvtc06/swvtc/DB/Intranet/Person%20Centered%20Thinking%20Blog/">Person Centered Thinking Blog</a> </li>
	<li><a href="http://swvtc06/swvtc/otherresources.asp" class="nav">Other Resources</a></li>
	<li><a href="http://swvtc06/swvtc/go.asp?site=Commonhealth" class="nav">Commonhealth</a></li>
	<li><a href="http://swvtc06/swvtc/training/default.asp" class="nav">Training</a></li>	
	<li><a href="http://www.collegeofdirectsupport.com/va" class="nav">College of Direct Support</a></li>
	<li><a href="https://covkc.virginia.gov/dmhmrsas/swvtc/Default.asp">Commonwealth of Virginia Knowledge Center</a> </li>
	<li><a href="https://secure.doa.virginia.gov/payline/" class="nav">Payline</a></li>
	<li><a href="http://swvtc06/swvtc/go.asp?site=CODIE" class="nav">CODIE</a></li>
	<li><a href="http://swvtc06/swvtc/go.asp?site=Internet" class="nav">Internet</a></li>
	<li><a href="http://swvtc06/swvtc/Help/default.asp" class="nav">Help</a></li>
</ul>
 
<div id="navweather">
 
	<img src="http://swvtc06/swvtc/rss/images/na.jpg" class="SmWeatherIcon" alt="NA">
	<span class="SmWeatherTemp">45 F (7 C)</span><br>
	<span class="SmWeatherText">NA</span><br>
	<a href="http://swvtc06/swvtc/weather.asp" class="WeatherDetailLink">click for details</a>
 
</div> 
</div> 
<div id="content"> 
	<script type="text/javascript">
		setUserOptions('content');
	</script> 
	<h1>Change Employee</h1> 
	
	<p><a href="auditEmployee.asp?EmpID=pl387881">View the 32 changes that have been made for this employee</a></p>
	
	<form action="" method="post" name="form1" class="defaultForm" onSubmit="return validate(this)"> 
		<fieldset> 
		<legend>Change Employee</legend> 
		<label for="FName" class="required">First Name:</label> 
		<input name="FName" id="FName" type="text" size="30" maxlength="50" value="John"> 
		<br> 
		<label for="MName">Middle Name:</label> 
		<input name="MName" id="MName" type="text" size="30" maxlength="50" value="D"> 
		<br> 
		<label for="LName" class="required">Last Name:</label> 
		<input name="LName" id="LName" type="text" size="30" maxlength="50" value="Doe"> 
		<br> 
		<label for="Suffix">Suffix:</label> 
		<input name="Suffix" id="Suffix" type="text" size="10" maxlength="8" value=""> 
		<br> 
		<label for="PosID" class="required">Position #:</label><select name="PosID" id="PosID" onChange="getPosEndDateBox(this.value);">
<option value="">-- Select One --</option>
 
<option value="00024">00024 - Direct Support Professional</option>
 
<option value="00032">00032 - Active Treatment Specialist</option>
 
<option value="00034">00034 - Chief of Hab. Services</option>
 
<option value="00044">00044 - Direct Support Professional</option>
 
<option value="00056">00056 - Direct Support Professional</option>
 
<option value="00071">00071 - Direct Support Professional</option>
 
<option value="00091">00091 - Direct Support Professional</option>
 
<option value="00111">00111 - Direct Support Professional</option>
 
<option value="00128">00128 - Direct Support Professional</option>
 
<option value="00133">00133 - Direct Support Professional</option>
 
<option value="00178">00178 - Human Resource Manager</option>
 
<option value="00185">00185 - Food Operations Assistant</option>
 
<option value="00229">00229 - Unit II Head Nurse</option>
 
<option value="00235">00235 - Night Shift Nursing Supervisor</option>
 
<option value="00238">00238 - Practical Nurse</option>
 
<option value="00240">00240 - Director of Psychological Services</option>
 
<option value="00264">00264 - Direct Support Professional</option>
 
<option value="00321">00321 - Direct Support Professional</option>
 
<option value="00334">00334 - Physical Therapist Assistant</option>
 
<option value="00353">00353 - </option>
 
<option value="00355">00355 - Direct Support Professional</option>
 
<option value="00399">00399 - Physical Therapist Assistant</option>
 
<option value="00407">00407 - IT Director</option>
 
<option value="00411">00411 - Installation and Repair Technician</option>
 
<option value="00443">00443 - </option>
 
<option value="00445">00445 - </option>
 
<option value="00458">00458 - Active Treatment Instructor</option>
 
<option value="00463">00463 - Academic Teacher (MS)</option>
 
<option value="00466">00466 - Physical Therapist Assistant</option>
 
<option value="00468">00468 - Unit Manager</option>
 
<option value="00469">00469 - Registered Nurse</option>
 
<option value="00470">00470 - Registered Nurse</option>
 
<option value="00481">00481 - Programmer</option>
 
<option value="00482">00482 - Vocational Instructor</option>
 
<option value="00617">00617 - Direct Support Professional</option>
 
<option value="00627">00627 - Direct Support Professional</option>
 
<option value="00635">00635 - Registered Nurse</option>
 
<option value="00645">00645 - Direct Support Professional</option>
 
<option value="14025" SELECTED>14025 - Registered Nurse</option>
 
<option value="14031">14031 - Dentist</option>
 
<option value="14033">14033 - Speech Pathologist</option>
 
<option value="14037">14037 - Occupational Therapist Assistant</option>
 
<option value="W0441">W0441 - Food Operations Assistant</option>
 
<option value="W0498">W0498 - Direct Support Professional</option>
 
<option value="W0742">W0742 - Food Operations Assistant</option>
 
<option value="W0748">W0748 - Food Operations Assistant</option>
 
<option value="W0753">W0753 - Food Operations Assistant</option>
 
<option value="W0754">W0754 - Food Operations Assistant</option>
 
<option value="W0756">W0756 - Registered Nurse</option>
 
<option value="W0757">W0757 - Food Operations Assistant</option>
 
<option value="W0758">W0758 - Food Operations Assistant</option>
 
<option value="W0759">W0759 - Food Operations Assistant</option>
 
<option value="W0760">W0760 - Food Operations Assistant</option>
 
<option value="W0761">W0761 - Food Operations Assistant</option>
 
<option value="W0762">W0762 - Food Operations Assistant</option>
 
<option value="W0763">W0763 - Food Operations Assistant</option>
 
<option value="W0764">W0764 - Direct Support Professional</option>
 
<option value="W0765">W0765 - Food Operations Assistant</option>
 
<option value="W0766">W0766 - Dental Assistant</option>
 
<option value="W0767">W0767 - Dentist</option>
 
<option value="W0768">W0768 - Physical Therapist</option>
 
<option value="W0769">W0769 - Food Operations Assistant</option>
 
<option value="W0771">W0771 - Food Operations Assistant</option>
 
<option value="W0772">W0772 - Registered Nurse</option>
 
<option value="W0774">W0774 - Recreation Therapist</option>
 
<option value="W0775">W0775 - Food Operations Assistant</option>
 
<option value="W0776">W0776 - Direct Support Professional</option>
 
<option value="W0777">W0777 - Food Operations Assistant</option>
 
<option value="W0779">W0779 - Food Operations Asst</option>
 
<option value="W0780">W0780 - Direct Support Professional</option>
 
<option value="W0781">W0781 - Food Operations Assistant</option>
 
<option value="W0782">W0782 - Direct Support Professional</option>
 
<option value="W0783">W0783 - Food Operations Assistant</option>
 
<option value="W0784">W0784 - Food Operations Assistant</option>
 
<option value="W0785">W0785 - Food Operations Assistant</option>
 
<option value="W0787">W0787 - Food Operations Assistant</option>
 
<option value="W0788">W0788 - Food Operations Assistant</option>
 
<option value="W0789">W0789 - Food Operations Assistant</option>
 
<option value="W0790">W0790 - Direct Support Professional</option>
 
<option value="W0791">W0791 - Food Operations Assistant</option>
 
<option value="W0792">W0792 - Food Operations Assistant</option>
 
<option value="W0795">W0795 - Direct Support Professional</option>
 
<option value="W0797">W0797 - Food Operations Assistant</option>
 
<option value="W0798">W0798 - Direct Support Professional</option>
 
<option value="W0802">W0802 - Food Operations Assistant</option>
 
<option value="w0803">w0803 - Food Operations Assistant</option>
 
<option value="W0806">W0806 - Food Operations Assistant</option>
 
<option value="W0807">W0807 - Food Operations Assistant</option>
 
</select>
		<br>
		<div id="datesContainer">
		<label for="PosStartDate" class="required">New Position Start Date:</label><input name="PosStartDate" id="PosStartDate" type="text" size="15" maxlength="15">
		<br>
		<label for="PosEndDate" class="required">Old Position End Date:</label><input name="PosEndDate" id="PosEndDate" type="text" size="15" maxlength="15">
		</div>
		<label for="StateEmpID" class="required">State Employee ID:</label> 
		<input name="StateEmpID" type="text" id="StateEmpID" size="15" maxlength="10" value="123456789"> 
		<br>		
		<label for="SSN" class="required">Social Security Number:</label>
		
		<input name="SSN1" type="text" id="SSN1" size="2" maxlength="3" value="123" onkeyup="if (this.value.length == 3) document.getElementById('SSN2').focus();">-<input name="SSN2" type="text" id="SSN2" size="1" maxlength="2" value="45" onkeyup="if (this.value.length == 2) document.getElementById('SSN3').focus();">-<input name="SSN3" type="text" id="SSN3" size="2" maxlength="4" value="6789">
		<br> 
		<label for="Salary" class="required">Salary:</label> 
		<input name="Salary" id="Salary" type="text" size="15" maxlength="15" value="15000"> 
		<br> 
		<label for="DOB" class="required">Date of Birth:</label> 
		<input name="DOB" id="DOB" type="text" size="15" maxlength="15" value="01/01/1960"> 
		M/D/YYYY<br> 
		<label for="Race" class="required">Race:</label> 
		<select name="Race" id="Race">
			<option value="" >-- Select One --</option>
			<option value="A" SELECTED>White</option>
			<option value="B" >Black</option>
			<option value="C" >Hispanic</option>
			<option value="D" >Asian/Pacific Islander</option>
			<option value="E" >American Indian/Alaskan Native</option>
			<option value="U" >Unknown</option> 
		</select> 
		<br> 
		<label for="Sex" class="required">Sex:</label> 
		<select name="Sex" id="Sex">
			<option value="" >-- Select One --</option>
			<option value="F" >Female</option>
			<option value="M" SELECTED>Male</option> 
		</select> 
		<br> 
		<label for="Address" class="required">Address:</label> 
		<input name="Address" id="Address" type="text" size="30" maxlength="50" value="123 Test Rd."> 
		<br> 
		<label for="OtherAddress">Other Address:</label> 
		<input name="OtherAddress" id="OtherAddress" type="text" size="30" maxlength="50" value=""> 
		<br> 
		<label for="City" class="required">City:</label> 
		<input name="City" id="City" type="text" size="30" maxlength="50" value="Testtown"> 
		<br> 
		<label for="State" class="required">State:</label> 
		<select name="State" id="State">
			<option value="" >-- Select One --</option>
			<option value="AL" >Alabama</option>
			<option value="AK" >Alaska</option>
			<option value="AZ" >Arizona</option>
			<option value="AR" >Arkansas</option>
			<option value="CA" >California</option>
			<option value="CO" >Colorado</option>
			<option value="CT" >Connecticut</option>
			<option value="DE" >Delaware</option>
			<option value="FL" >Florida</option>
			<option value="GA" >Georgia</option>
			<option value="HI" >Hawaii</option>
			<option value="ID" >Idaho</option>
			<option value="IL" >Illinois</option>
			<option value="IN" >Indiana</option>
			<option value="IA" >Iowa</option>
			<option value="KS" >Kansas</option>
			<option value="KY" >Kentucky</option>
			<option value="LA" >Louisiana</option>
			<option value="ME" >Maine</option>
			<option value="MD" >Maryland</option>
			<option value="MA" >Massachusetts</option>
			<option value="MI" >Michigan</option>
			<option value="MN" >Minnesota</option>
			<option value="MS" >Mississippi</option>
			<option value="MO" >Missouri</option>
			<option value="MT" >Montana</option>
			<option value="NE" >Nebraska</option>
			<option value="NV" >Nevada</option>
			<option value="NH" >New Hampshire</option>
			<option value="NJ" >New Jersey</option>
			<option value="NM" >New Mexico</option>
			<option value="NY" >New York</option>
			<option value="NC" >North Carolina</option>
			<option value="ND" >North Dakota</option>
			<option value="OH" >Ohio</option>
			<option value="OK" SELECTED>Oklahoma</option>
			<option value="OR" >Oregon</option>
			<option value="PA" >Pennsylvania</option>
			<option value="RI" >Rhode Island</option>
			<option value="SC" >South Carolina</option>
			<option value="SD" >South Dakota</option>
			<option value="TN" >Tennessee</option>
			<option value="TX" >Texas</option>
			<option value="UT" >Utah</option>
			<option value="VT" >Vermont</option>
			<option value="VA" >Virginia</option>
			<option value="WA" >Washington</option>
			<option value="WV" >West Virginia</option>
			<option value="WI" >Wisconsin</option>
			<option value="WY" >Wyoming</option> 
		</select> 
		<br> 
		<label for="Zip" class="required">Zip:</label> 
		<input name="Zip" id="Zip" type="text" size="15" maxlength="10" value="12345"> 
		<br>
		
		<label for="SeparationDate">Separation Date:</label> 
		<input name="SeparationDate" id="SeparationDate" type="text" size="15" maxlength="15" value=""> 
		M/D/YYYY<br> 
		<label for="SeparationReason">Separation Reason:</label> 
		<input name="SeparationReason" id="SeparationReason" type="text" size="15" maxlength="15" value=""> 
		M/D/YYYY<br> 
		<label for="Active">Active:</label> 
		<input checked name="Active" type="checkbox" id="Active" value="1">
		<br> 
		<label for="kludge"></label> 
		<input type="submit" value="Change Employee" id="submit"> 
		<input name="action" type="hidden" id="action" value="update">
		<input name="OriginalPosID" type="hidden" id="OriginalPosID" value="14025">		
		</fieldset> 
	</form> 
	<div id="lastmod"><span class="boldtext">This File Was Last Modified</span>:
		Thursday, February 12, 2009 
	</div> 
</div> 
</body>
</html>

Open in new window

0
 
Michel PlungjanIT ExpertCommented:
It works for me

You commented out this

window.onload=function() {
  document.getElementById('datesContainer').style.display='none'; // HIDE WHEN LOADING
.
.
.


0
 
dr00bieAuthor Commented:
When I select a new position, and don't enter any dates and click the Submit button, the page redirects instead of prompts me to enter the dates.  In other words, the validation doesn't seem to be changed when the date boxes are shown.

Thanks,
Drew
0
 
Michel PlungjanIT ExpertCommented:
Ah

But that is not what I saw

I will look tomorrow
0
 
dr00bieAuthor Commented:
Anymore on this?  If not, I will ask for a refund.

Thanks,
Drew
0
 
Michel PlungjanIT ExpertCommented:
1. my changes WORK if you uncomment the
document.getElementById('datesContainer').style.display='none'; // HIDE WHEN LOADING

2. the error is in the regular expression. If I change to

'PosStartDate','#q','3','You must enter a Position Start Date in the M/D/YYYY format.',

then I get the alert if I leave the date blank after I change profession
0
 
dr00bieAuthor Commented:
Yep, you are correct... the regular expression had an error in it.  Thanks for all your help!

Drew
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now