troubleshooting Question

Form Issues:

Avatar of albsallu
albsalluFlag for United States of America asked on
JavaScriptHTMLPHP
13 Comments1 Solution601 ViewsLast Modified:
Q1. How to get the result of this form?

Q2. I want result emailed to specific Program coordinator depending on what program is selected.

Q3. I am having errors on my date picker. It wont show up when I click the text box.
(*note* The code is attached and described below)
/*****************************************************************************************************************************
*This is the code for the form itself                                                                                        *
******************************************************************************************************************************\
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Peer Education Program Request Form</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<style type="text/css">
<!--
body {
        font: 100% Verdana, Arial, Helvetica, sans-serif;
        background: #666666;
        margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
        padding: 0;
        text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
        color: #000000;
}
.oneColElsCtr #container {
        width: 46em;
        background: #FFFFFF;
        margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
        border: 1px solid #000000;
        text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColElsCtr #mainContent {
        padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
}
.style1 {font-size: small}
.style2 {
	font-size: x-large;
	font-weight: bold;
}
.style3 {
	color: #FF0000;
	font-weight: bold;
	font-size: small;
}
 
-->
</style>
<script type="text/javascript">
function setOptions(chosen,selbox)
{
// selbox assignment deleted
  selbox.options.length = 0;
  if (chosen == " ") {
  selbox.options[selbox.options.length] = new Option('Please select one of the options above first',' ');
  setTimeout( function(){setOptions(' ',document.myform.optthree)},5);
  }
if (chosen == "1") {
  selbox.options[selbox.options.length] = new
  Option('Alcohol & Other Drug Workshop','11');
  setTimeout(function(){setOptions('11',document.myform.optthree)},5);
  }
if (chosen == "2") {
   selbox.options[selbox.options.length] = new
   Option('Wellness U','12');
    selbox.options[selbox.options.length] = new
   Option('The Mind Body Connection','12');
    selbox.options[selbox.options.length] = new
   Option('Eat Right, Stay Fit','12');
   setTimeout(function(){setOptions('12',document.myform.optthree)},5);
   }
if (chosen == "3") {
   selbox.options[selbox.options.length] = new
   Option('Female Survivor of Rape','13');
    selbox.options[selbox.options.length] = new
   Option('Male Survivor of Rape','13');
    selbox.options[selbox.options.length] = new
   Option('Relationship Violence','13');
      selbox.options[selbox.options.length] = new
   Option('Stalking','13');
    selbox.options[selbox.options.length] = new
   Option('Sexual Harrasment','13');
    selbox.options[selbox.options.length] = new
   Option('Boyfriend of Rape Survivor','13');
      selbox.options[selbox.options.length] = new
   Option('Room Mate of Rape Survivor','13');
    selbox.options[selbox.options.length] = new
   Option('Perpetrator Story','13');
    selbox.options[selbox.options.length] = new
   Option('Supportive Sorority Sister','13');
    selbox.options[selbox.options.length] = new
   Option('Fraternity Brother','13');
   setTimeout(function(){setOptions('13',document.myform.optthree)},5);
   }
if (chosen == "4") {
   selbox.options[selbox.options.length] = new
   Option('Sexual Assault','14');
    selbox.options[selbox.options.length] = new
   Option('Relationship Violence','14');
    selbox.options[selbox.options.length] = new
   Option('Stalking','14');
    selbox.options[selbox.options.length] = new
   Option('General OVA Information','14');
    selbox.options[selbox.options.length] = new
   Option('Crisis Intervention','14');
   setTimeout(function(){setOptions('14',document.myform.optthree)},5);
   }
if (chosen == "5") {
   selbox.options[selbox.options.length] = new
   Option('Safer Sex','15');
    selbox.options[selbox.options.length] = new
   Option('Contraceptive Education /Pap & Pelvic','15');
    selbox.options[selbox.options.length] = new
   Option('Partner Communication','15');
   setTimeout(function(){setOptions('15',document.myform.optthree)},5);
   }           
if (chosen == "6") {
  selbox.options[selbox.options.length] = new
  Option('Eating Disorders Workshop','16');
  setTimeout(function(){setOptions('16',document.myform.optthree)},5);
  }
if (chosen == "7") {
  selbox.options[selbox.options.length] = new
  Option('Depression /Suicide Prevention Program','17');
  setTimeout(function(){setOptions('17',document.myform.optthree)},5);
  }
// repeat for entries in first dropdown list
if (chosen == "11") {
  selbox.options[selbox.options.length] = new
  Option('Terp CHOICE - Judy Martinez','111');
  }
if (chosen == "12") {
  selbox.options[selbox.options.length] = new
  Option('HEALTH Works - Tracy Zeeger','112');
  }  
if (chosen == "13") {
  selbox.options[selbox.options.length] = new
  Option('SARPP Educators - Kimberly Bonner','113');
  }
if (chosen == "14") {
  selbox.options[selbox.options.length] = new
  Option('SHARE - Alli Matson','114');
  }
if (chosen == "15") {
  selbox.options[selbox.options.length] = new
  Option('SEEDS - Tracy Zeeger','115');
  }  
if (chosen == "16") {
  selbox.options[selbox.options.length] = new
  Option('SAHET - Carrie Martin','116');
  }  
// repeat for all the possible entries in second dropdown list
}
</script>
<link rel="stylesheet" title="CSS StyleSheet" href="cwcalendar.css" type="text/css" media="all" />
 
<script type="text/javascript" src="calendar.js">
</script>
</head>
<body class="oneColElsCtr">
<div id="container">
  <div id="mainContent">
    <p align="center" class="style3">&nbsp;</p>
    <table width="698" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1136"></td>
      </tr>
      <tr>
        <td><form name="myform"><div align="left">
          <p><u><strong>Program Information</strong></u></p>
          <p><span class="style1">Peer Program Requested *:</span>
            <select name="optone" size="1"
        onchange="setOptions(document.myform.optone.options
        [document.myform.optone.selectedIndex].value,
        document.myform.opttwo);">
              <option value=" " selected="selected"> </option>
              <option value="1">Terp CHOICES (Terps Choosing Healthy Options in College Environment Safely)</option>
              <option value="2">HEALTH works (Helping Establish A Lifestyle that Works)</option>
              <option value="3">SARPP Educators (Sexual Assault Response and Prevention Program)</option>
              <option value="4">SARPP Advocates (Sexual Assault Response and Prevention Program)</option>
              <option value="5">SHARE (Sexual Health And Reproductive Education)</option>
              <option value="6">SEEDS (Students Educating about Eating Disorders)</option>
              <option value="7">SAHET (Suicide Awareness Health Education and Training)</option>
            </select>
            <br>
          </p>
          <p><span class="style1">Topic Requested *:</span>
            <select name="opttwo" size="1"
        onchange="setOptions(document.myform.opttwo.options
        [document.myform.opttwo.selectedIndex].value,
        document.myform.optthree);">
              <option value=" " selected="selected">Please select one of the options above first</option>
            </select>
            <br>
          </p>
          <p><span class="style1">Program Coordinator:</span>
            <select name="optthree" size="1">
              <option value=" " selected="selected">Please select one of the options above first</option>
            </select>
            <!--<input type="button" name="go" value="Value Selected"
        onclick="alert(document.myform.optthree.options
        [document.myform.opttwo.selectedIndex].value);">-->
          </p>
          <p><span class="style1">First Choice date &amp; time *:</span> 
            <label>
            <input type="text" name="fcdate" id="fcdate" readonly onclick="fPopCalendar('data')" />
            </label>
            </p>
          <p><span class="style1">Second Choice date &amp; time *:</span>
            <label>
              <input type="text" name="scdate" id="scdate" readonly onclick="fPopCalendar('data')"/>
              </label>
          </p>
          <p><u><strong>Group Information</strong></u></p>
          <p><span class="style1">Name of Group, Class or Residence Hall *:</span> 
            <label>
            <input name="grpname" type="text" id="grpname" size="20" />
            </label>
            <span class="style1">Audience Size (At least 10):</span>
            <label>
            <select name="audsize" size="1" id="audsize">
              <option>10-15</option>
              <option>15-20</option>
              <option>20-30</option>
              <option>30-40</option>
              <option>40-50</option>
              <option>&gt;50</option>
            </select>
            </label>
          </p>
          <p><span class="style1">Short description of audience (Male /female; year, etc.):</span><br />
            <label>
            <textarea name="audescription" id="audescription" cols="70" rows="5"></textarea>
            </label>
          </p>
          <p><u><strong>Contact Information</strong></u></p>
          <p><span class="style1">Last Name: 
              <label>
              <input name="lname" type="text" id="lname" size="25" />
              </label>
          First Name: 
          <label>
          <input name="fname" type="text" id="fname" size="20" />
          </label>
          </span></p>
          <p><span class="style1">Phone: 
            </span>
            <label>
              <input name="phone" type="text" id="phone" value="000-000-0000" size="15" maxlength="16" />
                </label>
            <span class="style1">Alternate Phone:</span> 
            <label>
            <input name="altphone" type="text" id="altphone" value="000-000-000" size="15" maxlength="16" />
            </label>
          </p>
          <p class="style1">Email: 
            <label>
            <input name="conemail" type="text" id="conemail" size="50" maxlength="60" />
            </label>
          (e.g. jdoe@peered.edu)</p>
          <p class="style1">Other /Special Instructions:<br />
          
            <label>
            <textarea name="specinstruct" id="specinstruct" cols="70" rows="5"></textarea>
            </label>
          </p>
          <p align="center" class="style1">
            <label>
            <input type="submit" name="Submit" id="Submit" value="Submit" />
            </label>
            <label>
            <input type="reset" name="Reset" id="Reset" value="Reset" />
            </label>
          </p>
        </div>
        </form>
        </td>
      </tr>
    </table>
    <h1>&nbsp;</h1>
  </div>
</div>
</body>
</html>
 
/******************************************************************************************************************************
*This is the Calendar CSS code                                                                                                * 
*******************************************************************************************************************************
#calendar
{
	width: 241px;
	height: 165px;
	text-align: center;
	margin: 5px auto;
	border: 1px solid #f2f2f2;
	background-color: #f3f8ff;
	position: absolute;
	font: 11px Trebuchet MS;
}
 
ul
{
	list-style-type: none;
	margin:0;
	padding:0;
}
.months, .emptM, .headDay, .dayNormal, .dayBlank, .dayDisabled, .dayWeekend, .dayCurrent, .yearBrowse, .monthDisabled, .currMonth, #closeBtn  
{
	margin: 1px 0 0 1px;
	padding: 0;
	width: 39px;
	height: 14px;
	line-height: 14px;
	float: left;
	text-align: center;
	background-color: #feefe4;
	color: #000;
	display: inline;
}
.emptM, .dayDisabled, .monthDisabled
{
	color: #d7d6d5;
	background-color: #f2f2f2;
}
.headDay
{
	color: #fff;
	background-color: #48688f;
	width: 33px;
}
.dayNormal, .dayBlank, .dayWeekend, .dayCurrent
{
	color: #fff;
	background-color: #70b0ff;
	width: 33px;
}
.dayBlank{background-color: #f3f8ff}
.dayWeekend{background-color: #ff6161}
.dayCurrent, .currMonth{background-color: #71d45b}
.dayDisabled{width: 33px}
#days{margin-left: 1px; width: 238px;}
#elements{height: 150px;}
.months a, #days a, .currMonth a{color: #000; text-decoration: none; display: block;}
.currMonth a{color: #FFF}
#days a{color: #fff;}
.yearBrowse, #closeBtn {width: 240px; background-color: #FFF; line-height: 14px;}
.yearBrowse a, #closeBtn a{text-decoration: none; color: #f30; font-weight: bold;}
.yearBrowse b{margin: 0 5px}
 
/******************************************************************************************************************************
*This is the javascript for the calendar                                                                                      *
*******************************************************************************************************************************\
/*
 * If the date is not set, make it the clients PC date!
 */
if(typeof(iMonth)=="undefined")
	iMonth = new Date().getMonth();
if(typeof(iYear)=="undefined")
	iYear = new Date().getFullYear();
if(typeof(iDay)=="undefined")
	iDay = new Date().getDate();
if(typeof(itype) == "undefined")
	itype = "loose" //loose->any date|strict->limit to maxDays
if(typeof(imaxDays) == "undefined")
	imaxDays = 330 //counts only if itype=strict. Enable selection imaxDays from start date
if(typeof(stDay) == "undefined")
	startDay = iDay; //enable selection from this date
if(typeof(stMonth) == "undefined")
	startMonth = iMonth;
if(typeof(stYear) == "undefined")
	startYear = iYear;
if(typeof(addZero) == "undefined")
	addZero = true; //true|false. Put 0 in front of days&months if <10
if(typeof(offX) == "undefined")
	offX = 10 // x distance from the mouse.
if(typeof(offY) == "undefined")
	offY = -10 // y distance from the mouse.
if(typeof(formatInputs) == "undefined")
	formatInputs = 1 // Gather the data from no. of inputs
if(typeof(formatSplitter) == "undefined")
	formatSplitter = "/" // Character to add betwen day/month/year
if(typeof(monthFormat) == "undefined")
	monthFormat = "mm";
if(typeof(yearFormat) == "undefined")
	yearFormat = "yy";
if(typeof(folowMouse) == "undefined")
	folowMouse = true;
if(typeof(formatType) == "undefined")
	formatType = yearFormat+formatSplitter+monthFormat+formatSplitter+"dd"; //Format data type
if(typeof(callNotice) == "undefined")
	callNotice = "fallsilent()"; //call another function that a date has been selected.
 
 
if (window.addEventListener)
	window.addEventListener("load", createBase, false)
else if (window.attachEvent)
	window.attachEvent("onload", createBase)
else if (document.getElementById)
	window.onload=createBase
 
 
 
document.onmousemove = getMouseXY;
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE)
 
var tempX = 0
var tempY = 0
 
function getMouseXY(e) {
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
 
  return true
}
 
 
function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}
 
 
 
/*
 * Shortcut functions to ease the implementation.
 */
 
var d = document;
function cel(obj){ return d.createElement(obj);  }
function sa(obj, atname, atprop){ return  obj.setAttribute(atname, atprop);  }
function appendc(obj, elem){ return  obj.appendChild(elem); }
function cNode(obj, txt){ return obj.appendChild(d.createTextNode(txt)); }
function getID(elem){ return d.getElementById(elem); }
 
var DayCol = new Array("M", "T", "W", "T", "F", "S", "S");
var MonthCol = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov", "Dec")
 
function getDaysInMonth(mnt, yr)
{
	var DaysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
	if (mnt == 1)
	  DaysInMonth[1] = ((yr % 400 == 0) || ((yr % 4 == 0) && (yr % 100 !=0))) ? 29 : 28;
	return DaysInMonth[mnt];
}
/*
 * Base object for the widget
 */  
 
var cw = {
	currMonth: iMonth,
	currYear: iYear,
	currDay: iDay,
	selMonth: iMonth,
	selYear: iYear,
	selDay: iDay,
	config: itype,
	maxDays: imaxDays,
	stMonth : startMonth,
	stYear : startYear,
	stDay : startDay,
	endMonth : 11,
	endYear : iYear,
	endDay : 31,
	addZ: addZero, 
	setMarks: function()
	{
		if(this.config=='strict')
		{
			this.stDay = iDay;
			this.stMonth = iMonth;
			this.stYear = iYear;
			this.getEnd();
		}
	},
	getConfMonths: function()
	{
		if(this.config=='strict')
			cw.setMarks();
		mthCol = cel("ul");
		mthCol.id = "months";
		k=0;
		  for(i=0;i<12; i++)
		  {
				mth = cel("li");
				if(cw.isValidMonth(i))
				{
					mth.className = "months";
					if(cw.isCurrentMonth(i))
						mth.className = "currMonth";
					mtha = cel("a");
					mtha.href = "javascript:modMonth("+this.selYear+"," + i + ")";
					mtha.innerHTML = MonthCol[i];
					appendc(mth, mtha);
				}
				else
				{
					mth.className = "monthDisabled";
					mth.innerHTML = MonthCol[i];
				}
				appendc(mthCol, mth)
				
		  }
		cw.setBrowseYears();		
		
		return mthCol ;
	},
	getConfDays: function()
	{
		dayCol = cel("ul");
		dayCol.id = "days";
		for(i=0;i<7;i++)
		{
			dayCell = cel("li");
			dayCell.className = "headDay";
			dayCell.innerHTML = DayCol[i];
			appendc(dayCol, dayCell);
		}
		var iFirstDay = new Date(this.selYear, this.selMonth, 1).getDay();
		iFirstDay--
		if(iFirstDay<0){iFirstDay=6}
		for(i=0;i<iFirstDay;i++)
		{
			dayCell = cel('li');
			dayCell.className = "dayBlank";
			dayCell.innerHTML = "&nbsp;";
			appendc(dayCol, dayCell)
		}
		for(i=1;i<=getDaysInMonth(this.selMonth, this.selYear); i++)
		{
			dayCell = cel('li');
			if(cw.isValidDate(i))
			{
				dayCell.className = "dayNormal";
				if(cw.isWeekend(i))
					dayCell.className = "dayWeekend";
				if(cw.isCurrentDay(i))
					dayCell.className = "dayCurrent";
				dayLink = cel('a');
				dayLink.href="javascript: newDay("+ i + ");fillBackDate("+i+","+this.selMonth+","+ this.selYear+")";
				dayLink.innerHTML = i;
				appendc(dayCell, dayLink);
			}
			else
			{
				dayCell.className = "dayDisabled";
				dayCell.innerHTML = i;
			}
			appendc(dayCol, dayCell)
		}
		return dayCol;
	},
	getEnd: function()
	{
		imaxD = imaxDays - (getDaysInMonth(this.stMonth, this.stYear) - this.stDay);
		tmpM = this.stMonth;
		tmpY = this.stYear;
		tmpD = this.stDay;
		i=0;
		while(imaxD >= getDaysInMonth(tmpM, tmpY))
		{
			tmpM++
			if(tmpM>11)
			{
				tmpM=0
				tmpY++;
			}
			tmpD = imaxD -= getDaysInMonth(tmpM, tmpY);
		}
		tmpM++
		if(tmpM>11){tmpM=0; tmpY++}
		this.endMonth = tmpM;
		this.endDay = tmpD;
		this.endYear = tmpY;
	},
	isValidDate: function(tDay)
	{
		if(this.config == "loose")
			return true;
		if(this.selYear==this.stYear)
		{
			if(this.selMonth<this.stMonth)
				return false;
			if(this.selMonth==this.stMonth && tDay <this.stDay)
				return false;
		}
		if(this.selYear==this.endYear)
		{
			if(this.selMonth>this.endMonth)
				return false;
			if(this.selMonth==this.endMonth && tDay>this.endDay)
				return false;
				
		}
		if(this.selYear == this.endYear && this.selYear==this.stYear){
			if(this.selMonth> this.endMonth || this.selMonth<this.stMonth)
				return false;
			}
		if(this.selYear>this.endYear)
			return false;
		return true;
		
	},
	isWeekend: function(tDay)
	{
		sun = new Date(this.selYear, this.selMonth, tDay).getDay();
		if(sun==6||sun==0)
			return true;
		return false;
	},
	isCurrentDay: function(tDay)
	{
		if(this.selDay == tDay)
			return true;
		return false;
	},
	setBrowseYears: function()
	{
		brsY = cel('li');
		brsY.className = "yearBrowse";
		if(this.selYear <= this.stYear && this.config == "strict")
		{
			backB = cel('span');	
		}
		else
		{
			backB= cel('a');
			backB.href = "javascript: modYear(-1)";
		}
		backB.innerHTML = "&laquo";
		yText = cel("b");
		yText.innerHTML = cw.selYear;
		if(this.selYear >= this.endYear && this.config == "strict")
			fwdB = cel('span');
		else
		{
			fwdB = cel('a');
			fwdB.href= "javascript: modYear(1)";
		}
		fwdB.innerHTML = "&raquo;";
		appendc(brsY, backB);
		appendc(brsY, yText);
		appendc(brsY, fwdB);
		appendc(mthCol, brsY);
	},
	isValidMonth: function(m)
	{
		if(this.config == "loose")
			return true;
		else
		{
			if(this.selYear< this.stYear)
				return false;
			if(this.selYear==this.stYear && m<this.stMonth)
				return false;
			if(this.selYear>this.endYear)
				return false;
			if(this.selYear==this.endYear && m>this.endMonth)
				return false;
		}	
		return true;
	},
	isCurrentMonth: function(i)
	{
		if(i==this.selMonth)
			return true
		return false;
	}
}
 
cw.setMarks();
function createBase()
{
	var el = cel('div');
	el.id="calendar";
	el.style.display="none";
	if(typeof(elToAppend) == "undefined")
		tDocument = document.getElementsByTagName('body').item(0);
	else
	{
		var tt = elToAppend;
		tDocument = document.getElementById(tt);
	}
	appendc(tDocument, el);	
}
 
 
function createCalendarElements()
{
	var el = 'calendar';
	var calCon = cel('div');
	calCon.id = "elements";
	while(document.getElementById(el).firstChild)
		document.getElementById(el).removeChild(document.getElementById(el).firstChild);
	appendc(document.getElementById(el), calCon);
	mthCol = cw.getConfMonths();
	appendc(calCon, mthCol);
	dayStruct = cw.getConfDays();
	appendc(calCon, dayStruct);
 
	closeBtn = cel('div');
	closeBtn.id = "closeBtn";
	closeBtna = cel('a');
	closeBtna.href = "javascript: closeCalendar()";
	closeBtna.innerHTML = "close";
	appendc(closeBtn, closeBtna);
	appendc(document.getElementById(el), closeBtn);
}
function modMonth(newY, newM)
{
	cw.selYear = newY;
	cw.selMonth = newM;
	createCalendarElements();
}
function newDay(newD)
{
	cw.selDay = newD;
	createCalendarElements();
}
function modYear(way)
{
	cw.selYear = parseInt(cw.selYear) + parseInt(way);
	createCalendarElements();	
}
var datas;
var elem1;
var elem2;
var elem3;
var mA=0;
var yA=0;
var mm = new Array('mm', 'mmm');
var yy = new Array('yy', 'yyyy');
 
function fPopCalendar(param1, param2, param3)
{
	tmpString = new String();
	if(formatInputs==1)
	{
		elem1 = param1;
		tmpString = document.getElementById(elem1).value;
	}
	if(formatInputs==2)
	{
		elem1 = param1;
		elem2 = param2;
		tmpString = document.getElementById(elem1).value + formatSplitter + document.getElementById(elem2).value;
	}
	if(formatInputs==3)
	{
		elem1 = param1;
		elem2 = param2;
		elem3 = param3;
		tmpString = document.getElementById(elem1).value + formatSplitter + 
					document.getElementById(elem2).value+ formatSplitter +
					document.getElementById(elem3).value;
	}
	datas  = tmpString.split(formatSplitter);
	tmpo = formatType.split(formatSplitter);
	dC="";tC="";
	if(datas.length == tmpo.length)
	{
		for(i=0;i<datas.length;i++)
		{
			if(datas[i].length<2)
				datas[i] = "0"+datas[i];
			dC +=datas[i];
			tC +=tmpo[i]; 
		}
		if(dC.length == tC.length)
			orderData();
	}
	else
		datas = new Array(cw.selDay, cw.selMonth, cw.selYear);
	createCalendarElements();
	offsets = getScrollXY();
	document.getElementById('calendar').style.display = "block";
 
	if(folowMouse)
	{
		var browser=navigator.appName;
		if(browser=="Microsoft Internet Explorer")
		{
			document.getElementById('calendar').style.left = parseInt(tempX)+parseInt(offX)+parseInt(offsets[0]) + 'px';
		    document.getElementById('calendar').style.top = parseInt(tempY)+parseInt(offY)+parseInt(offsets[1]) + 'px';
		}
		else
		{
			document.getElementById('calendar').style.left = parseInt(tempX)+parseInt(offX)+ 'px';
		    document.getElementById('calendar').style.top = parseInt(tempY)+parseInt(offY)+ 'px';
		}
	}
	order = new String(formatType).split(formatSplitter);
 
	for(i=0;i<mm.length;i++)
	{
		for(j=0;j<order.length;j++)
		{
			if(mm[i] == order[j])
				mA = i;
			if(yy[i] == order[j])
				yA = i;
		}
	}
}
 
function orderData()
{
 
	order = new String(formatType).split(formatSplitter);
 
	for(i=0;i<order.length;i++)
	{
		for(j=0;j<mm.length;j++)
		{
			if(mm[j] == order[i])
			{
				cw.selMonth = datas[i];
				if(cw.selMonth.slice(0, 1) == 0)
					cw.selMonth = parseInt(cw.selMonth.slice(1, cw.selMonth.length))-1;
				else if(cw.selMonth.length<3)
					cw.selMonth = parseInt(cw.selMonth)-1;
				if(j==1)
				{
					for(k=0;k<MonthCol.length;k++)
					{
						if(MonthCol[k].toLowerCase() == cw.selMonth.toLowerCase() )
						{
							cw.selMonth = k;
							break;
						}
					}
				}
			}
			if(yy[j] == order[i])
			{
				cw.selYear = datas[i];
				if(cw.selYear.slice(0, 1) == 0)
					cw.selYear = parseInt(cw.selYear.slice(1, cw.selYear.length));
				if(j==0)
					cw.selYear =2000 + parseInt(cw.selYear);
			}				
		}
		if(order[i].toLowerCase() == 'dd')
		{
			cw.selDay = datas[i];
			if(cw.selDay.slice(0, 1) == 0)
				cw.selDay = parseInt(cw.selDay.slice(1, cw.selDay.length));
		}
	}
}
 
function fillBackDate(tDay, tMonth, tYear)
{
	if(mA==1)
		tMonth = MonthCol[tMonth];
	if(mA==0)
	{
		tMonth++;
		if(tMonth<10  && cw.addZ == true)
			tMonth = "0"+tMonth;
	}
	if(yA==0)
		tYear = new String(tYear).slice(2,4);
	if(tDay<10 && cw.addZ == true)
	{
		tDay = "0"+tDay;
	}
	
	if(formatType.slice(0,2)!= "dd")
	{
		tmpDATA = tDay;
		tDay = tYear;
		tYear = tmpDATA;
	}
	
	if(formatInputs==1)
	{
		document.getElementById(elem1).value = tDay + formatSplitter + tMonth + formatSplitter + tYear;
	}
	if(formatInputs==2)
	{
		document.getElementById(elem1).value = tDay;
		document.getElementById(elem2).value = tMonth + formatSplitter + tYear;
	}
	if(formatInputs==3)
	{
		document.getElementById(elem1).value = tDay;
		document.getElementById(elem2).value = tMonth;
		document.getElementById(elem3).value = tYear;
	}
	setTimeout(callNotice, 0);
	
	closeCalendar();
}
 
function closeCalendar()
{
	var el = 'calendar';
	document.getElementById(el).style.display = "none";
}
function fallsilent(){}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 13 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros