Checkboxes and Values (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


dzirkelb1 -> Checkboxes and Values (4/16/2008 12:22:06)

I have a line of code:

<td><input type="checkbox" id="chkPTO<%=i%>" name="chkPTO<%=i%>" <%if rs("PTO") = -1 then%> checked <%end if%> value="-1"	 onChange="SaveRecord('[PTO]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtPTOHrs<%=i%>, chkPTO<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>


The problem I am having is when it is checked, it passes a -1...thats good. However, when i uncheck it, it passes a -1 again. How do I make it pass a 0 when it is unchecked? Or, just pass nothing?




dzirkelb1 -> RE: Checkboxes and Values (4/17/2008 14:08:36)

When I take out the value of -1, then it returns the value ON even when it is unchecked. Any ideas? I would rally rather have a checkbox then a yes / no drop down.




rdouglass -> RE: Checkboxes and Values (4/18/2008 1:55:37)

You should be able to do this; use the checkbox like that. Can you post more code to give us a better understanding of what you're trying to do?




dzirkelb1 -> RE: Checkboxes and Values (4/18/2008 8:45:40)

<!-- #include file="dbole.inc" -->
<%
dim rs, ssql
dim i
dim intLineCount

i = 1

set rs = Server.CreateObject ("adodb.Recordset")
ssql = "SELECT COUNT(VacaID) AS LineCount FROM VacationData WHERE (VacaEndDate >= #"&Date()&"#) AND (Approved = -1) AND (FilterOut = 0)"
rs.Open ssql, dbc, adOpenForwardOnly, adLockReadOnly

if not rs.eof then
	intLineCount = rs("LineCount")
end if

rs.close
set rs=nothing

set rs = Server.CreateObject ("adodb.Recordset")
ssql = " SELECT VacationData.VacaID, VacationData.VacaStartDate, VacationData.VacaEndDate, VacationData.[Last Name] AS LastName, VacationData.[First Name] AS FirstName, VacationData.VacaEnter, VacationData.ApprovedBy, VacationData.Vacation, VacationData.PTO, VacationData.PTOHrs, VacationData.InternalNotes, VacationData.Approved, VacationData.FilterOut"
ssql = ssql & " FROM VacationData"
ssql = ssql & " WHERE (VacationData.VacaEndDate >= #"&Date()&"#) AND (VacationData.Approved = -1) AND (VacationData.FilterOut = 0)"
ssql = ssql & " ORDER BY VacationData.VacaStartDate"
rs.Open ssql, dbc, adOpenForwardOnly, adLockReadOnly


%>

<html>
<head>
<title>Vacation Mgmt Menu Approved</title>

<script type="text/javascript">
<!--

function enterFirstLine(NextField, NextFieldDown)
{
	if(window.event && window.event.keyCode == 40) {
		NextFieldDown.focus();}	
		
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function enterLastLine(NextField, NextFieldUp)
{
	if(window.event && window.event.keyCode == 38) {
		NextFieldUp.focus();}		
		
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function enterOnlyLine(NextField)
{
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function ChangeColor(Cell, i)
{
	document.getElementById(Cell).style.backgroundColor='cyan';
	document.getElementById("tr" + i).style.backgroundColor='red';
}

function ChangeColorBlur(Cell, i)
{
	document.getElementById(Cell).style.backgroundColor='';
	document.getElementById("tr" + i).style.backgroundColor='';
}

function enter(NextField, NextFieldDown, NextFieldUp)
{
	if(window.event && window.event.keyCode == 40) {
		NextFieldDown.focus();}
		
	if(window.event && window.event.keyCode == 38) {
		NextFieldUp.focus();}		
		
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function CheckDate(input) {
  var reg = /^(\d{1,2})\/(\d{1,2})\/(\d{2}|\d{4})$/;
  	if (!reg.test(input.value))
		alert("Invalid Date Format. Please correct and submit again.")

  var m = input.value.match(reg);
  if (m) {
    var month = m[1];
    var day = m[2];
    var year = 2000 + parseInt(m[3]);
    // Check for valid date
    var date = new Date(year,month-1,day);
    if (date.getMonth()+1 != month || date.getDate() != day || date.getFullYear() != year)
      alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
      return false;
    return true;
  }
  
	else {
    input.select();
    return false;
  }
}

var xmlHttp;
var intI;
 
function SaveRecord(strFieldName, VacaID, strValue)
{
	var url="VacationMgmtMenu-save.asp?Value=" + strValue + "&FieldName=" + strFieldName + "&VacaID=" + VacaID
	alert(url)
	xmlHttp=GetXmlHttpObject(stateChangedSaveRecord)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null) 
}

function stateChangedSaveRecord()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        xmlHttp.responseText
    }
}

function GetXmlHttpObject(handler)
{
    var objXmlHttp=null
 
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
}  

-->
</script>

</head>

<body>

<table border="1" cellpadding="0" cellspacing="0">
	<tr>
		<th><font face="verdana" size="1">VacID</font></th>
		<th><font face="verdana" size="1">Vac Start Date</font></th>
		<th><font face="verdana" size="1">Vac End Date</font></th>
		<th><font face="verdana" size="1">Last Name</font></th>
		<th><font face="verdana" size="1">First Name</font></th>
		<th><font face="verdana" size="1">Vac Enter Date</font></th>
		<th><font face="verdana" size="1">Vacation</font></th>
		<th><font face="verdana" size="1">PTO</font></th>
		<th><font face="verdana" size="1">PTO Hours</font></th>
		<th><font face="verdana" size="1">Approved</font></th>
		<th><font face="verdana" size="1">Approved By</font></th>
		<th><font face="verdana" size="1">Filter Out</font></th>
		<th><font face="verdana" size="1">Internal Notes</font></th>
	</tr>
	<%
	do while not rs.eof
		i = i + 1
		if i = 2 then
	%>
			<tr id="tr<%=i%>">
				<td><input type="text" id="txtVacaID<%=i%>" name="txtVacaID<%=i%>" value="<%=rs("VacaID")%>" onkeydown="return enterFirstLine(txtVacaStartDate<%=i%>, txtVacaID<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
				<td><input type="text" id="txtVacaStartDate<%=i%>" name="txtVacaStartDate<%=i%>" value="<%=rs("VacaStartDate")%>" onChange="CheckDate(this), SaveRecord('[VacaStartDate]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtVacaEndDate<%=i%>, txtVacaStartDate<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtVacaEndDate<%=i%>" name="txtVacaEndDate<%=i%>" value="<%=rs("VacaEndDate")%>" onChange="CheckDate(this), SaveRecord('[VacaEndDate]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtLastName<%=i%>, txtVacaEndDate<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtLastName<%=i%>" name="txtLastName<%=i%>" value="<%=rs("LastName")%>" onChange="SaveRecord('[Last Name]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtFirstName<%=i%>, txtLastName<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtFirstName<%=i%>" name="txtFirstName<%=i%>" value="<%=rs("FirstName")%>" onChange="SaveRecord('[First Name]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtVacaEnter<%=i%>, txtFirstName<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtVacaEnter<%=i%>" name="txtVacaEnter<%=i%>" value="<%=rs("VacaEnter")%>" onChange="CheckDate(this), SaveRecord('[VacaEnter]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtVacaEndDate<%=i%>, txtVacaEnter<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td>
                <input type="checkbox" id="chkVacation<%=i%>" name="chkVacation<%=i%>" <% if rs("Vacation") = -1 then%>checked<%end if%>  onChange="SaveRecord('[Vacation]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(chkPTO<%=i%>, chkVacation<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off" value="ON"></td>
				<td><input type="checkbox" id="chkPTO<%=i%>" name="chkPTO<%=i%>" <%if rs("PTO") = -1 then%> checked <%end if%> value="-1"	 onChange="SaveRecord('[PTO]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtPTOHrs<%=i%>, chkPTO<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtPTOHrs<%=i%>" name="txtPTOHrs<%=i%>" value="<%=rs("PTOHrs")%>" onChange="SaveRecord('[PTOHrs]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(chkApproved<%=i%>, txtPTOHrs<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="checkbox" id="chkApproved<%=i%>" name="chkApproved<%=i%>" <%if rs("Approved") = -1 then%> checked<%end if%> value="-1" onChange="SaveRecord('[Approved]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtApprovedBy<%=i%>, chkApproved<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtApprovedBy<%=i%>" name="txtApprovedBy<%=i%>" value="<%=rs("ApprovedBy")%>" onChange="SaveRecord('[ApprovedBy]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(chkFilterOut<%=i%>, txtApprovedBy<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="checkbox" id="chkFilterOut<%=i%>" name="chkFilterOut<%=i%>" <%if rs("FilterOut") = -1 then%> checked<%end if%> value="-1" onChange="SaveRecord('[FilterOut]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtInternalNotes<%=i%>, chkFilterOut<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtInternalNotes<%=i%>" name="txtInternalNotes<%=i%>" value="<%=rs("InternalNotes")%>" onChange="SaveRecord('[InternalNotes]', <%=rs("VacaID")%>, this.value)" onkeydown="return enterFirstLine(txtVacaID<%=i+1%>, txtInternalNotes<%=i+1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
			</tr>
	<%
		else
			if i > 2 and i < intLineCount+1 then
	%>
				<tr id="tr<%=i%>">
					<td><input type="text" id="txtVacaID<%=i%>" name="txtVacaID<%=i%>" value="<%=rs("VacaID")%>" onkeydown="return enter(txtVacaStartDate<%=i%>, txtVacaID<%=i+1%>, txtVacaID<%=i-1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate<%=i%>" name="txtVacaStartDate<%=i%>" value="<%=rs("VacaStartDate")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate<%=i%>" name="txtVacaEndDate<%=i%>" value="<%=rs("VacaEndDate")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName<%=i%>" name="txtLastName<%=i%>" value="<%=rs("LastName")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName<%=i%>" name="txtFirstName<%=i%>" value="<%=rs("FirstName")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter<%=i%>" name="txtVacaEnter<%=i%>" value="<%=rs("VacaEnter")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation<%=i%>" name="chkVacation<%=i%>" <% if rs("Vacation") = -1 then%>checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO<%=i%>" name="chkPTO<%=i%>" <%if rs("PTO") = -1 then%> checked <%end if%> value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs<%=i%>" name="txtPTOHrs<%=i%>" value="<%=rs("PTOHrs")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved<%=i%>" name="chkApproved<%=i%>" <%if rs("Approved") = -1 then%> checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy<%=i%>" name="txtApprovedBy<%=i%>" value="<%=rs("ApprovedBy")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut<%=i%>" name="chkFilterOut<%=i%>" <%if rs("FilterOut") = -1 then%> checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes<%=i%>" name="txtInternalNotes<%=i%>" value="<%=rs("InternalNotes")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	<%
			else
				if cInt(intLineCount)+1 = i then
	%>
					<tr id="tr<%=i%>">
						<td><input type="text" id="txtVacaID<%=i%>" name="txtVacaID<%=i%>" value="<%=rs("VacaID")%>" onkeydown="return enterLastLine(txtVacaStartDate<%=i%>, txtVacaID<%=i-1%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
						<td><input type="text" id="txtVacaStartDate<%=i%>" name="txtVacaStartDate<%=i%>" value="<%=rs("VacaStartDate")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtVacaEndDate<%=i%>" name="txtVacaEndDate<%=i%>" value="<%=rs("VacaEndDate")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtLastName<%=i%>" name="txtLastName<%=i%>" value="<%=rs("LastName")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtFirstName<%=i%>" name="txtFirstName<%=i%>" value="<%=rs("FirstName")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtVacaEnter<%=i%>" name="txtVacaEnter<%=i%>" value="<%=rs("VacaEnter")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkVacation<%=i%>" name="chkVacation<%=i%>" <% if rs("Vacation") = -1 then%>checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkPTO<%=i%>" name="chkPTO<%=i%>" <%if rs("PTO") = -1 then%> checked <%end if%> value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtPTOHrs<%=i%>" name="txtPTOHrs<%=i%>" value="<%=rs("PTOHrs")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkApproved<%=i%>" name="chkApproved<%=i%>" <%if rs("Approved") = -1 then%> checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtApprovedBy<%=i%>" name="txtApprovedBy<%=i%>" value="<%=rs("ApprovedBy")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkFilterOut<%=i%>" name="chkFilterOut<%=i%>" <%if rs("FilterOut") = -1 then%> checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtInternalNotes<%=i%>" name="txtInternalNotes<%=i%>" value="<%=rs("InternalNotes")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
					</tr>	
	<%
				else
					if intLineCount = 1 then
	%>
						<tr id="tr<%=i%>">
							<td><input type="text" id="txtVacaID<%=i%>" name="txtVacaID<%=i%>" value="<%=rs("VacaID")%>" onkeydown="return enterOnlyLine(txtVacaStartDate<%=i%>)" onFocus="ChangeColor(this.id, <%=i%>)" onBlur="ChangeColorBlur(this.id, <%=i%>)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
							<td><input type="text" id="txtVacaStartDate<%=i%>" name="txtVacaStartDate<%=i%>" value="<%=rs("VacaStartDate")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtVacaEndDate<%=i%>" name="txtVacaEndDate<%=i%>" value="<%=rs("VacaEndDate")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtLastName<%=i%>" name="txtLastName<%=i%>" value="<%=rs("LastName")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtFirstName<%=i%>" name="txtFirstName<%=i%>" value="<%=rs("FirstName")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtVacaEnter<%=i%>" name="txtVacaEnter<%=i%>" value="<%=rs("VacaEnter")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="checkbox" id="chkVacation<%=i%>" name="chkVacation<%=i%>" <% if rs("Vacation") = -1 then%>checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="checkbox" id="chkPTO<%=i%>" name="chkPTO<%=i%>" <%if rs("PTO") = -1 then%> checked <%end if%> value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtPTOHrs<%=i%>" name="txtPTOHrs<%=i%>" value="<%=rs("PTOHrs")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="checkbox" id="chkApproved<%=i%>" name="chkApproved<%=i%>" <%if rs("Approved") = -1 then%> checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtApprovedBy<%=i%>" name="txtApprovedBy<%=i%>" value="<%=rs("ApprovedBy")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="checkbox" id="chkFilterOut<%=i%>" name="chkFilterOut<%=i%>" <%if rs("FilterOut") = -1 then%> checked<%end if%> value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
							<td><input type="text" id="txtInternalNotes<%=i%>" name="txtInternalNotes<%=i%>" value="<%=rs("InternalNotes")%>" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
						</tr>					
	<%
					end if
				end if
			end if
		end if
	
	rs.moveNext
	Loop
	
	rs.close
	set rs=nothing
	
	dbc.close
	set dbc=nothing
	%>
</table>

</body>
</html>


The first section of the table rows on the if then statement is the only one I am working on at the moment, then I will do the rest of the if then statements. It is basically an ajax paget that saves the data on change. However, for the checkbox, for my alert(url), it always shows either -1 (or ON if I put no value on the checkbox).

thanks




rdouglass -> RE: Checkboxes and Values (4/18/2008 9:09:35)

Have you checked a loaded page (view source) to see if there are duplicate checkbox names?

I haven't looked at it too deeply but with all those 'i's in there, you could be duplicating a box.

Also, is there a chance you have a URL where we can look? I am specifically looking for what is actually written to the browser with this:

onChange="SaveRecord('[PTOHrs]', <%=rs("VacaID")%>, this.value)"

so I guess I'm asking what the rendered page looks like.

Further, in this statement:

"However, for the checkbox, for my alert(url), it always shows either -1 (or ON if I put no value on the checkbox)"

what exactly is 'it'? Is it the section here:

function SaveRecord(strFieldName, VacaID, strValue)
{
	var url="VacationMgmtMenu-save.asp?Value=" + strValue + "&FieldName=" + strFieldName + "&VacaID=" + VacaID
	alert(url)
	xmlHttp=GetXmlHttpObject(stateChangedSaveRecord)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null) 
}


where your posting via AJAX? How are you determining the value it's picking up / where exactly do you see it?




dzirkelb1 -> RE: Checkboxes and Values (4/18/2008 11:51:52)

I can't post the page because it is password protected...but I'll look if I can find a web to post it on that isn't password protected (the whole site is)

I am not even getting to the ajax page at this point...well, it gets there, but it is sending the wrong information there.

When i say "it", i mean the alert(url) I have placed on the javascript function.

The ajax page that does the save is this:

<!-- #include file="dbole.inc" -->
<%
dim rs, ssql
dim strFieldName, strValue
dim intVacaID

strFieldName = request.querystring("FieldName")
strValue = request.querystring("Value")
intVacaID = request.querystring("VacaID")

ssql = "UPDATE VacationData SET "&strFieldName&" = '"&strValue&"' WHERE (VacaID = "&intVacaID&")"
response.write(ssql)
dbc.execute(ssql)
%>


The saves work on everything else on that page, and, technically work on the checkboxes also; however, a -1 (or on) is always sent so I cant' uncheck them and save the data. I know this by the alert I have posted on the OnChange event.




rdouglass -> RE: Checkboxes and Values (4/18/2008 12:11:45)

Oh!!! (light bulb gets a little brighter)

I think with JS, a -1 is Null so you are getting the stuff (I think anyways). Or is it really supposed to be -1

Without seeing the page code its togh to say tho. What would be the chance of you PM'ing me a fully rendered page with all the stuff in it? (Not the ASP page but once it's sent to the browser?)

If not, can you at least post this full alert message that comes from this:

var url="VacationMgmtMenu-save.asp?Value=" + strValue + "&FieldName=" + strFieldName + "&VacaID=" + VacaID
alert(url)

Are you picking up *any* of those values?







dzirkelb1 -> RE: Checkboxes and Values (4/18/2008 15:08:29)

quote:


VacationMgmtMenu-save.asp?Value=-1&FieldName=[Vacation]&VacaID=4149


That is the pop-up regardless if it is checked or not.

Somethign wierd here. If you have the PTO box highlihgted on the first row (the only real row with code on it for the onchange event), then refresh the page without changing the data, then tab away, the OnChange event fires off. I do not know why, but it leaves it as checked.

Here is the view source:



<html>
<head>
<title>Vacation Mgmt Menu Approved</title>

<script type="text/javascript">
<!--

function enterFirstLine(NextField, NextFieldDown)
{
	if(window.event && window.event.keyCode == 40) {
		NextFieldDown.focus();}	
		
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function enterLastLine(NextField, NextFieldUp)
{
	if(window.event && window.event.keyCode == 38) {
		NextFieldUp.focus();}		
		
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function enterOnlyLine(NextField)
{
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function ChangeColor(Cell, i)
{
	document.getElementById(Cell).style.backgroundColor='cyan';
	document.getElementById("tr" + i).style.backgroundColor='red';
}

function ChangeColorBlur(Cell, i)
{
	document.getElementById(Cell).style.backgroundColor='';
	document.getElementById("tr" + i).style.backgroundColor='';
}

function enter(NextField, NextFieldDown, NextFieldUp)
{
	if(window.event && window.event.keyCode == 40) {
		NextFieldDown.focus();}
		
	if(window.event && window.event.keyCode == 38) {
		NextFieldUp.focus();}		
		
	if(window.event && window.event.keyCode == 13) {
		NextField.focus();
		return false; }
	else
		return true;
}

function CheckDate(input) {
  var reg = /^(\d{1,2})\/(\d{1,2})\/(\d{2}|\d{4})$/;
  	if (!reg.test(input.value))
		alert("Invalid Date Format. Please correct and submit again.")

  var m = input.value.match(reg);
  if (m) {
    var month = m[1];
    var day = m[2];
    var year = 2000 + parseInt(m[3]);
    // Check for valid date
    var date = new Date(year,month-1,day);
    if (date.getMonth()+1 != month || date.getDate() != day || date.getFullYear() != year)
      alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
      return false;
    return true;
  }
  
	else {
    input.select();
    return false;
  }
}

var xmlHttp;
var intI;
 
function SaveRecord(strFieldName, VacaID, strValue)
{
	var url="VacationMgmtMenu-save.asp?Value=" + strValue + "&FieldName=" + strFieldName + "&VacaID=" + VacaID
	alert(url)
	xmlHttp=GetXmlHttpObject(stateChangedSaveRecord)
    xmlHttp.open("GET", url , true)
    xmlHttp.send(null) 
}

function stateChangedSaveRecord()
{
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    {
        xmlHttp.responseText
    }
}

function GetXmlHttpObject(handler)
{
    var objXmlHttp=null
 
    if (navigator.userAgent.indexOf("Opera")>=0)
    {
        alert("Opera not supported...")
        return;
    }
    if (navigator.userAgent.indexOf("MSIE")>=0)
    {
        var strName="Msxml2.XMLHTTP"
        if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
        {
            strName="Microsoft.XMLHTTP"
        }
        try
        {
            objXmlHttp=new ActiveXObject(strName)
            objXmlHttp.onreadystatechange=handler
            return objXmlHttp
        }
        catch(e)
        {
            alert("Error. Scripting for ActiveX might be disabled")
            return
        }
    }
    if (navigator.userAgent.indexOf("Mozilla")>=0)
    {
        objXmlHttp=new XMLHttpRequest()
        objXmlHttp.onload=handler
        objXmlHttp.onerror=handler
        return objXmlHttp
    }
}  

-->
</script>

</head>

<body>

<table border="1" cellpadding="0" cellspacing="0">
	<tr>
		<th><font face="verdana" size="1">VacID</font></th>
		<th><font face="verdana" size="1">Vac Start Date</font></th>
		<th><font face="verdana" size="1">Vac End Date</font></th>
		<th><font face="verdana" size="1">Last Name</font></th>
		<th><font face="verdana" size="1">First Name</font></th>
		<th><font face="verdana" size="1">Vac Enter Date</font></th>
		<th><font face="verdana" size="1">Vacation</font></th>
		<th><font face="verdana" size="1">PTO</font></th>
		<th><font face="verdana" size="1">PTO Hours</font></th>
		<th><font face="verdana" size="1">Approved</font></th>
		<th><font face="verdana" size="1">Approved By</font></th>
		<th><font face="verdana" size="1">Filter Out</font></th>
		<th><font face="verdana" size="1">Internal Notes</font></th>
	</tr>
	
			<tr id="tr2">
				<td><input type="text" id="txtVacaID2" name="txtVacaID2" value="4149" onkeydown="return enterFirstLine(txtVacaStartDate2, txtVacaID3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
				<td><input type="text" id="txtVacaStartDate2" name="txtVacaStartDate2" value="4/22/2008" onChange="CheckDate(this), SaveRecord('[VacaStartDate]', 4149, this.value)" onkeydown="return enterFirstLine(txtVacaEndDate2, txtVacaStartDate3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtVacaEndDate2" name="txtVacaEndDate2" value="4/22/2008" onChange="CheckDate(this), SaveRecord('[VacaEndDate]', 4149, this.value)" onkeydown="return enterFirstLine(txtLastName2, txtVacaEndDate3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtLastName2" name="txtLastName2" value="Prull" onChange="SaveRecord('[Last Name]', 4149, this.value)" onkeydown="return enterFirstLine(txtFirstName2, txtLastName3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtFirstName2" name="txtFirstName2" value="Sandy" onChange="SaveRecord('[First Name]', 4149, this.value)" onkeydown="return enterFirstLine(txtVacaEnter2, txtFirstName3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtVacaEnter2" name="txtVacaEnter2" value="4/17/2008" onChange="CheckDate(this), SaveRecord('[VacaEnter]', 4149, this.value)" onkeydown="return enterFirstLine(txtVacaEndDate2, txtVacaEnter3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td>
                <input type="checkbox" id="chkVacation2" name="chkVacation2"  value="-1" onChange="SaveRecord('[Vacation]', 4149, this.value)" onkeydown="return enterFirstLine(chkPTO2, chkVacation3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off" value="ON"></td>
				<td><input type="checkbox" id="chkPTO2" name="chkPTO2"  checked  value="-1"	 onChange="SaveRecord('[PTO]', 4149, this.value)" onkeydown="return enterFirstLine(txtPTOHrs2, chkPTO3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtPTOHrs2" name="txtPTOHrs2" value="3" onChange="SaveRecord('[PTOHrs]', 4149, this.value)" onkeydown="return enterFirstLine(chkApproved2, txtPTOHrs3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="checkbox" id="chkApproved2" name="chkApproved2"  checked value="-1" onChange="SaveRecord('[Approved]', 4149, this.value)" onkeydown="return enterFirstLine(txtApprovedBy2, chkApproved3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtApprovedBy2" name="txtApprovedBy2" value="JEG" onChange="SaveRecord('[ApprovedBy]', 4149, this.value)" onkeydown="return enterFirstLine(chkFilterOut2, txtApprovedBy3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="checkbox" id="chkFilterOut2" name="chkFilterOut2"  value="-1" onChange="SaveRecord('[FilterOut]', 4149, this.value)" onkeydown="return enterFirstLine(txtInternalNotes2, chkFilterOut3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
				<td><input type="text" id="txtInternalNotes2" name="txtInternalNotes2" value="Doctor with Larry" onChange="SaveRecord('[InternalNotes]', 4149, this.value)" onkeydown="return enterFirstLine(txtVacaID3, txtInternalNotes3)" onFocus="ChangeColor(this.id, 2)" onBlur="ChangeColorBlur(this.id, 2)" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
			</tr>
	
				<tr id="tr3">
					<td><input type="text" id="txtVacaID3" name="txtVacaID3" value="4148" onkeydown="return enter(txtVacaStartDate3, txtVacaID4, txtVacaID2)" onFocus="ChangeColor(this.id, 3)" onBlur="ChangeColorBlur(this.id, 3)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate3" name="txtVacaStartDate3" value="4/22/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate3" name="txtVacaEndDate3" value="4/22/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName3" name="txtLastName3" value="Pfranger" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName3" name="txtFirstName3" value="Lisa" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter3" name="txtVacaEnter3" value="4/17/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation3" name="chkVacation3"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO3" name="chkPTO3"  checked  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs3" name="txtPTOHrs3" value="1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved3" name="chkApproved3"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy3" name="txtApprovedBy3" value="JEG" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut3" name="chkFilterOut3"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes3" name="txtInternalNotes3" value="Personal reason" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr4">
					<td><input type="text" id="txtVacaID4" name="txtVacaID4" value="4143" onkeydown="return enter(txtVacaStartDate4, txtVacaID5, txtVacaID3)" onFocus="ChangeColor(this.id, 4)" onBlur="ChangeColorBlur(this.id, 4)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate4" name="txtVacaStartDate4" value="4/29/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate4" name="txtVacaEndDate4" value="4/29/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName4" name="txtLastName4" value="Burrows" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName4" name="txtFirstName4" value="Maylene " style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter4" name="txtVacaEnter4" value="4/14/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation4" name="chkVacation4"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO4" name="chkPTO4"  checked  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs4" name="txtPTOHrs4" value="1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved4" name="chkApproved4"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy4" name="txtApprovedBy4" value="JEG" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut4" name="chkFilterOut4"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes4" name="txtInternalNotes4" value="Heart Doctor" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr5">
					<td><input type="text" id="txtVacaID5" name="txtVacaID5" value="3857" onkeydown="return enter(txtVacaStartDate5, txtVacaID6, txtVacaID4)" onFocus="ChangeColor(this.id, 5)" onBlur="ChangeColorBlur(this.id, 5)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate5" name="txtVacaStartDate5" value="5/22/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate5" name="txtVacaEndDate5" value="5/27/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName5" name="txtLastName5" value="Zirkelbach" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName5" name="txtFirstName5" value="Dave " style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter5" name="txtVacaEnter5" value="11/9/2007" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation5" name="chkVacation5" checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO5" name="chkPTO5"  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs5" name="txtPTOHrs5" value="0" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved5" name="chkApproved5"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy5" name="txtApprovedBy5" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut5" name="chkFilterOut5"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes5" name="txtInternalNotes5" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr6">
					<td><input type="text" id="txtVacaID6" name="txtVacaID6" value="4020" onkeydown="return enter(txtVacaStartDate6, txtVacaID7, txtVacaID5)" onFocus="ChangeColor(this.id, 6)" onBlur="ChangeColorBlur(this.id, 6)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate6" name="txtVacaStartDate6" value="5/27/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate6" name="txtVacaEndDate6" value="5/30/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName6" name="txtLastName6" value="Kjenaas" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName6" name="txtFirstName6" value="Rita" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter6" name="txtVacaEnter6" value="2/13/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation6" name="chkVacation6"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO6" name="chkPTO6"  checked  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs6" name="txtPTOHrs6" value="32" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved6" name="chkApproved6"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy6" name="txtApprovedBy6" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut6" name="chkFilterOut6"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes6" name="txtInternalNotes6" value="vacation; houseboat --- ok'd the 5/27 even though Dianne is gone too that day" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr7">
					<td><input type="text" id="txtVacaID7" name="txtVacaID7" value="3970" onkeydown="return enter(txtVacaStartDate7, txtVacaID8, txtVacaID6)" onFocus="ChangeColor(this.id, 7)" onBlur="ChangeColorBlur(this.id, 7)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate7" name="txtVacaStartDate7" value="5/27/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate7" name="txtVacaEndDate7" value="5/27/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName7" name="txtLastName7" value="Barfels" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName7" name="txtFirstName7" value="Dianne" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter7" name="txtVacaEnter7" value="1/15/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation7" name="chkVacation7" checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO7" name="chkPTO7"  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs7" name="txtPTOHrs7" value="0" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved7" name="chkApproved7"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy7" name="txtApprovedBy7" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut7" name="chkFilterOut7"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes7" name="txtInternalNotes7" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr8">
					<td><input type="text" id="txtVacaID8" name="txtVacaID8" value="3997" onkeydown="return enter(txtVacaStartDate8, txtVacaID9, txtVacaID7)" onFocus="ChangeColor(this.id, 8)" onBlur="ChangeColorBlur(this.id, 8)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate8" name="txtVacaStartDate8" value="6/27/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate8" name="txtVacaEndDate8" value="6/30/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName8" name="txtLastName8" value="Edmonds" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName8" name="txtFirstName8" value="Debbie" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter8" name="txtVacaEnter8" value="2/5/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation8" name="chkVacation8" checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO8" name="chkPTO8"  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs8" name="txtPTOHrs8" value="0" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved8" name="chkApproved8"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy8" name="txtApprovedBy8" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut8" name="chkFilterOut8"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes8" name="txtInternalNotes8" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr9">
					<td><input type="text" id="txtVacaID9" name="txtVacaID9" value="3996" onkeydown="return enter(txtVacaStartDate9, txtVacaID10, txtVacaID8)" onFocus="ChangeColor(this.id, 9)" onBlur="ChangeColorBlur(this.id, 9)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate9" name="txtVacaStartDate9" value="6/27/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate9" name="txtVacaEndDate9" value="6/30/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName9" name="txtLastName9" value="Edmonds" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName9" name="txtFirstName9" value="Don" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter9" name="txtVacaEnter9" value="2/5/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation9" name="chkVacation9" checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO9" name="chkPTO9"  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs9" name="txtPTOHrs9" value="0" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved9" name="chkApproved9"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy9" name="txtApprovedBy9" value="JEG" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut9" name="chkFilterOut9"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes9" name="txtInternalNotes9" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr10">
					<td><input type="text" id="txtVacaID10" name="txtVacaID10" value="3610" onkeydown="return enter(txtVacaStartDate10, txtVacaID11, txtVacaID9)" onFocus="ChangeColor(this.id, 10)" onBlur="ChangeColorBlur(this.id, 10)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate10" name="txtVacaStartDate10" value="7/2/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate10" name="txtVacaEndDate10" value="7/4/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName10" name="txtLastName10" value="Barfels" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName10" name="txtFirstName10" value="Dianne" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter10" name="txtVacaEnter10" value="7/5/2007" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation10" name="chkVacation10" checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO10" name="chkPTO10"  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs10" name="txtPTOHrs10" value="0" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved10" name="chkApproved10"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy10" name="txtApprovedBy10" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut10" name="chkFilterOut10"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes10" name="txtInternalNotes10" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
				<tr id="tr11">
					<td><input type="text" id="txtVacaID11" name="txtVacaID11" value="3615" onkeydown="return enter(txtVacaStartDate11, txtVacaID12, txtVacaID10)" onFocus="ChangeColor(this.id, 11)" onBlur="ChangeColorBlur(this.id, 11)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
					<td><input type="text" id="txtVacaStartDate11" name="txtVacaStartDate11" value="7/7/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEndDate11" name="txtVacaEndDate11" value="7/7/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtLastName11" name="txtLastName11" value="Wolf" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtFirstName11" name="txtFirstName11" value="Claudia" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtVacaEnter11" name="txtVacaEnter11" value="7/6/2007" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkVacation11" name="chkVacation11"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkPTO11" name="chkPTO11"  checked  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtPTOHrs11" name="txtPTOHrs11" value="8" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkApproved11" name="chkApproved11"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtApprovedBy11" name="txtApprovedBy11" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="checkbox" id="chkFilterOut11" name="chkFilterOut11"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
					<td><input type="text" id="txtInternalNotes11" name="txtInternalNotes11" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
				</tr>	
	
					<tr id="tr12">
						<td><input type="text" id="txtVacaID12" name="txtVacaID12" value="3939" onkeydown="return enterLastLine(txtVacaStartDate12, txtVacaID11)" onFocus="ChangeColor(this.id, 12)" onBlur="ChangeColorBlur(this.id, 12)" style="font: Verdana; font-size: 8pt" size="20" readonly autocomplete="off"></td>
						<td><input type="text" id="txtVacaStartDate12" name="txtVacaStartDate12" value="12/26/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtVacaEndDate12" name="txtVacaEndDate12" value="12/26/2008" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtLastName12" name="txtLastName12" value="Wolf" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtFirstName12" name="txtFirstName12" value="Claudia" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtVacaEnter12" name="txtVacaEnter12" value="12/31/2007" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkVacation12" name="chkVacation12"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkPTO12" name="chkPTO12"  checked  value="-1"	 style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtPTOHrs12" name="txtPTOHrs12" value="8" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkApproved12" name="chkApproved12"  checked value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtApprovedBy12" name="txtApprovedBy12" value="Todd" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="checkbox" id="chkFilterOut12" name="chkFilterOut12"  value="-1" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"></td>
						<td><input type="text" id="txtInternalNotes12" name="txtInternalNotes12" value="" style="font: Verdana; font-size: 8pt" size="20" autocomplete="off"</td>
					</tr>	
	
</table>

</body>
</html>


And I am going to PM you a site that has the page on an non-password protected page. I'll give instructinos on what to change and what not to change on the PM.

I'm not too concerned what values are passed on teh checkbox as I can always do an if then statemetn on the save page to change the values, I just need them to be different when on and off and consistent.




rdouglass -> RE: Checkboxes and Values (4/21/2008 10:15:14)

Hi Dave,

I don't know if this will affect other areas but I think I know what you were trying to do. SO what I did was to rework that SaveRecord JS function like this:

function SaveRecord(strFieldName, VacaID, strFormField)
{
var url=""
if (strFormField.checked) {
url="VacationMgmtMenu-save.asp?Value=" + strFormField.value + "&FieldName=" + strFieldName + "&VacaID=" + VacaID
} else {
url="VacationMgmtMenu-save.asp?Value=0&FieldName=" + strFieldName + "&VacaID=" + VacaID
}
alert(url)
xmlHttp=GetXmlHttpObject(stateChangedSaveRecord)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

and changed the onChange for the checkboxes to this:

onChange="SaveRecord('[PTO]', <%=rs("VacaID")%>, this)"

See, what I did was instead of passing the checkbox value (this.value), I pass the whole checkbox object (this). Then the JS function determines if it's checked or not. If i'ts checked, it puts the '-1' (whic I assume is for true) and if not, it uses a '0' for false.

I didn't see where you'd use the value anywhere else in that function so I think this should work for you.

Hope it helps.




dzirkelb1 -> RE: Checkboxes and Values (4/21/2008 11:48:22)

That did the trick for the checkboxes, thanks a lot!




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.171875