473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

need help with onChange event

As you can see from the code below, several textboxes will be
dynamically created and each will be tied to an org. The
ChangeComment function should allow for an update to the database
whenever the value of the associated textbox changes. However, I'm
having trouble associating the textbox to the org. strOrg is a global
variable which changes throughout the runtime.
How do I capture its value at each stage a textbox is created so that
I can point back to it later when the onChange event is run?
here's the code
sorry I included the whole page, but I didn't know what might be
relevant.


<%@ Language=VBScript %>
<% Option Explicit %>
<! DOCTYPE HTML PUBLIC "=//W3C//DTD HTML 4.01 Transitional//EN">
<!--#include file="dbconnect.asp"-->
<html>

<head>
<title>Report</title>
<link href="exec.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<%
dim strSql
dim objConn
dim objRs
dim strActiveDate
dim dtmActiveDate
dim arrAllOrgs

Session("thisDate") = ""
strActiveDate = Request.Querystring("activeDate")
if Session("thisDate") = "" then
if strActiveDate = "" then
dtmActiveDate = Date
Select Case WeekDay (dtmActiveDate)
Case 1
dtmActiveDate = DateAdd("d", -6, dtmActiveDate)
Case 2
Case 3
dtmActiveDate = DateAdd("d", -1, dtmActiveDate)
Case 4
dtmActiveDate = DateAdd("d", -2, dtmActiveDate)
Case 5
dtmActiveDate = DateAdd("d", -3, dtmActiveDate)
Case 6
dtmActiveDate = DateAdd("d", -4, dtmActiveDate)
Case 7
dtmActiveDate = DateAdd("d", -5, dtmActiveDate)
End Select
else
dtmActiveDate = FormatDateTime(strActiveDate, vbShortDate)
end if
else
dtmActiveDate = Session("thisDate")
end if
Session("thisDate") = dtmActiveDate

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = dbconn
objConn.Open
strSql = "SELECT DISTINCT [org] FROM [office]"
Set objRs = objConn.Execute(strSql)
if NOT objRs.EOF then
arrAllOrgs = objRs.GetRows
end if
objRs.Close
Set objRs = Nothing

if NOT isEmpty(arrAllOrgs) then
Session("userKey") = 1
strSql = "SELECT [office.org], [office.position], [office.officeKey],
[rights.type], [rights.userKey] FROM [Office], [Rights] WHERE
[Office.officeKey] = [Rights.officeKey] AND [Rights.userKey] =
"&Session("userKey")&" ORDER BY [Office.position]"
Set objRs = objConn.Execute(strSql)
dim strOrgList
dim strPosList
dim strOfficeKeyList
dim strRghtTypeList
dim strRghtUserKeyList

strOrgList = ""
strPosList = ""
strOfficeKeyList = ""
strRghtTypeList = ""
strRghtUserKeyList = ""

do while NOT objRs.EOF
strOrgList = strOrgList&""""&Cstr(objRs("office.org"))&""","
strPosList = strPosList&""""&Cstr(objRs("office.position"))&""" ,"
strOfficeKeyList =
strOfficeKeyList&""""&Cstr(objRs("office.officeKey "))&""","
strRghtTypeList = strRghtTypeList&""""&Cstr(objRs("rights.type"))&"" ","
strRghtUserKeyList =
strRghtUserKeyList&""""&Cstr(objRs("rights.userKey "))&""","
objRs.MoveNext
loop

Set objRs = Nothing

strOrgList = Left(strOrgList, Len(strOrgList) - 1)
strPosList = Left(strPosList, Len(strPosList) - 1)
strOfficeKeyList = Left(strOfficeKeyList, Len(strOfficeKeyList) - 1)
strRghtTypeList = Left(strRghtTypeList, Len(strRghtTypeList) - 1)
strRghtUserKeyList = Left(strRghtUserKeyList, Len(strRghtUserKeyList)
- 1)

dim strOfficeKeyListTwo
dim strActiveDateList
dim strLocationList
dim strLeaveTypeList

strOfficeKeyListTwo = ""
strActiveDateList = ""
strLocationList = ""
strLeaveTypeList = ""

dim objRsTwo
strSql = "SELECT [events.officeKey], [events.activeDate],
[events.location], [events.leavetype] FROM [Events]"
Set objRsTwo = objConn.Execute(strSql)

do while NOT objRsTwo.EOF
strOfficeKeyListTwo =
strOfficeKeyListTwo&""""&Cstr(objRsTwo("events.off iceKey"))&""","
strActiveDateList =
strActiveDateList&""""&Cstr(objRsTwo("events.activ eDate"))&""","
strLocationList = strLocationList&""""&Cstr(objRsTwo("events.locatio n"))&""","
strLeaveTypeList =
strLeaveTypeList&""""&Cstr(objRsTwo("events.leavet ype"))&""","
objRsTwo.MoveNext
loop

objRsTwo.Close
Set objRsTwo = Nothing

if NOT strOfficeKeyListTwo = "" then
strOfficeKeyListTwo = Left(strOfficeKeyListTwo,
Len(strOfficeKeyListTwo) - 1)
end if
if NOT strActiveDateList = "" then
strActiveDateList = Left(strActiveDateList, Len(strActiveDateList) -
1)
end if
if NOT strLocationList = "" then
strLocationList = Left(strLocationList, Len(strLocationList) - 1)
end if
if NOT strLeaveTypeList = "" then
strLeaveTypeList = Left(strLeaveTypeList, Len(strLeaveTypeList) - 1)
end if

dim strOrgListTwo
dim strDescriptionList
dim strActiveDateListTwo

strOrgListTwo = ""
strDescriptionList = ""
strActiveDateListTwo = ""

dim objRsThree
strSql = "SELECT [notes.org], [notes.description], [notes.activeDate]
FROM [Notes]"
Set objRsThree = objConn.Execute(strSql)

do while NOT objRsThree.EOF
strOrgListTwo = strOrgListTwo&""""&Cstr(objRsThree("notes.org"))&" "","
strDescriptionList =
strDescriptionList&""""&Cstr(objRsThree("notes.des cription"))&""","
strActiveDateListTwo =
strActiveDateListTwo&""""&Cstr(objRsThree("notes.a ctiveDate"))&""","
objRsThree.MoveNext
loop

Set objRsThree = Nothing
objConn.Close
Set objConn = Nothing

if NOT strOrgListTwo = "" then
strOrgListTwo = Left(strOrgListTwo, Len(strOrgListTwo) - 1)
end if
if NOT strDescriptionList = "" then
strDescriptionList = Left(strDescriptionList,
Len(strDescriptionList) - 1)
end if
if NOT strActiveDateListTwo = "" then
strActiveDateListTwo = Left(strActiveDateListTwo,
Len(strActiveDateListTwo) - 1)
end if
end if
%>
</head>

<body>
<table id = "tblAvailReport" border="1">
</table>
<script language="JavaScript">

function ChangeComment()
{
var thisOrg = strOrg;
var orgFrmComment =
document.getElementById(thisOrg).getElementsByTagN ame("INPUT")[0];
alert(orgFrmComment.value);
alert(activeWeekBegins);
window.location.replace("submitComments.asp?org="+ thisOrg+"&strComments="+orgFrmComment.value+"&Date ="+activeWeekBegins);
}

function toggleStripe()
{
if (stripeColor)
{
stripeColor = ""
}
else
{
stripeColor = " bgcolor=\"#CCCCCC\""
}
}

var row=top.menu.row
var arrOrgList = new Array(<%=strOrgList%>);
var arrPosList = new Array(<%=strPosList%>);
var arrOfficeKeyList = new Array(<%=strOfficeKeyList%>);
var arrRghtsTypeList = new Array(<%=strRghtTypeList%>);
var arrRghtsUserKeyList = new Array(<%=strRghtUserKeyList%>);

var arrOfficeKeyListTwo = new Array(<%=strOfficeKeyListTwo%>);
var arrActiveDateList = new Array(<%=strActiveDateList%>);
var arrLocationList = new Array(<%=strLocationList%>);
var arrLeaveTypeList = new Array(<%=strLeaveTypeList%>);

var arrOrgListTwo = new Array(<%=strOrgListTwo%>);
var arrDescriptionList = new Array(<%=strDescriptionList%>);
var arrActiveDateListTwo = new Array(<%=strActiveDateListTwo%>);

var weekDay = new Array(7);
weekDay[0] = "Sun";
weekDay[1] = "Mon";
weekDay[2] = "Tues";
weekDay[3] = "Wed";
weekDay[4] = "Thurs";
weekDay[5] = "Fri";
weekDay[6] = "Sat";

var oneDay = 86400000;
var month = <%=DatePart("m", dtmActiveDate)%>
var month = month - 1
var day = <%=DatePart("d", dtmActiveDate)%>
var year = <%=DatePart("yyyy", dtmActiveDate)%>
var today = new Date(year, month, day);

var week = new Array(7);
milli = today.getTime();
activeDateTwo = new Date (milli + oneDay);
milli = activeDateTwo.getTime();
activeDateThree = new Date (milli + oneDay);
milli = activeDateThree.getTime();
activeDateFour = new Date (milli + oneDay);
milli = activeDateFour.getTime();
activeDateFive = new Date (milli + oneDay);
milli = activeDateFive.getTime();
activeDateSix = new Date (milli + oneDay);
milli = activeDateSix.getTime();
activeDateSeven = new Date(milli + oneDay);

var week = new Array(7);
week[1] = today;
week[2] = activeDateTwo;
week[3] = activeDateThree;
week[4] = activeDateFour;
week[5] = activeDateFive;
week[6] = activeDateSix;
week[7] = activeDateSeven;

var monthfirstday = week[1].getMonth() + 1;
var monthsecondday = week[2].getMonth() + 1;
var monththirdday = week[3].getMonth() + 1;
var monthfourthday = week[4].getMonth() + 1;
var monthfifthday = week[5].getMonth() + 1;
var monthsixthday = week[6].getMonth() + 1;
var monthseventhday = week[7].getMonth() + 1;

row = top.menu.row
stripeColor = ""

var tblOrgMainTable = document.getElementById("tblAvailReport");
var headerOrgMainTable = document.createElement("THEAD");
var rowHeaderOrgMainTable = document.createElement("TR");
var cellHeaderOrgMainTable = document.createElement("TH");
cellHeaderOrgMainTable.setAttribute("width", "25%");
var strHeaderOrgMainTableLabel = document.createTextNode
("Org/Position");

var cellDayOne = document.createElement("TH");
cellDayOne.setAttribute("width", "11%");
var strDayOneLabel =
document.createTextNode(weekDay[week[1].getDay()]+"/"+monthfirstday+"/"+week[1].getDate()+"/"+week[1].getYear());
var cellDayTwo = document.createElement("TH");
cellDayTwo.setAttribute("width", "11%");
var strDayTwoLabel =
document.createTextNode(weekDay[week[2].getDay()]+"/"+monthsecondday+"/"+week[2].getDate()+"/"+week[2].getYear());
var cellDayThree = document.createElement("TH");
cellDayThree.setAttribute("width", "11%");
var strDayThreeLabel =
document.createTextNode(weekDay[week[3].getDay()]+"/"+monththirdday+"/"+week[3].getDate()+"/"+week[3].getYear());
var cellDayFour = document.createElement("TH");
cellDayFour.setAttribute("width", "11%");
var strDayFourLabel =
document.createTextNode(weekDay[week[4].getDay()]+"/"+monthfourthday+"/"+week[4].getDate()+"/"+week[4].getYear());
var cellDayFive = document.createElement("TH");
cellDayFive.setAttribute("width", "11%");
var strDayFiveLabel =
document.createTextNode(weekDay[week[5].getDay()]+"/"+monthfifthday+"/"+week[5].getDate()+"/"+week[5].getYear());
var cellDaySix = document.createElement("TH");
cellDaySix.setAttribute("width", "11%");
var strDaySixLabel =
document.createTextNode(weekDay[week[6].getDay()]+"/"+monthsixthday+"/"+week[6].getDate()+"/"+week[6].getYear());
var cellDaySeven = document.createElement("TH");
cellDaySeven.setAttribute("width", "11%");
var strDaySevenLabel =
document.createTextNode(weekDay[week[7].getDay()]+"/"+monthseventhday+"/"+week[7].getDate()+"/"+week[7].getYear());
cellHeaderOrgMainTable.appendChild(strHeaderOrgMai nTableLabel);
rowHeaderOrgMainTable.appendChild(cellHeaderOrgMai nTable);
cellDayOne.appendChild(strDayOneLabel);
rowHeaderOrgMainTable.appendChild(cellDayOne);
cellDayTwo.appendChild(strDayTwoLabel);
rowHeaderOrgMainTable.appendChild(cellDayTwo);
cellDayThree.appendChild(strDayThreeLabel);
rowHeaderOrgMainTable.appendChild(cellDayThree);
cellDayFour.appendChild(strDayFourLabel);
rowHeaderOrgMainTable.appendChild(cellDayFour);
cellDayFive.appendChild(strDayFiveLabel);
rowHeaderOrgMainTable.appendChild(cellDayFive);
cellDaySix.appendChild(strDaySixLabel);
rowHeaderOrgMainTable.appendChild(cellDaySix);
cellDaySeven.appendChild(strDaySevenLabel);
rowHeaderOrgMainTable.appendChild(cellDaySeven);
headerOrgMainTable.appendChild(rowHeaderOrgMainTab le);
tblOrgMainTable.appendChild(headerOrgMainTable);

for (i=0; i<row.length; i++)
{
var strOrg = row[i];

var bodyOrgMainTable =
document.getElementById("tblAvailReport").getEleme ntsByTagName("TBODY")[0];
var rowOrgMainTable = document.createElement("TR");
var cellOrgMainTable = document.createElement("TD");
cellOrgMainTable.colSpan = "8";
var tableOrgToAdd = document.createElement("TABLE");
tableOrgToAdd.setAttribute("border", "1");
tableOrgToAdd.setAttribute("width", "100%");
var tbodyOrgToAdd = document.createElement("TBODY");
var rowOrgHeader = document.createElement("TR");
var cellOrgHeader = document.createElement("TD");
cellOrgHeader.setAttribute("width", "25%");
var strOrgLabel = document.createTextNode(strOrg);

cellOrgHeader.appendChild(strOrgLabel);
rowOrgHeader.appendChild(cellOrgHeader);
tbodyOrgToAdd.appendChild(rowOrgHeader);
var activeComments = "no";

for (j=0; j<arrOrgList.length; j++)
{
if (arrOrgList[j] == strOrg)
{
var strPos = arrPosList[j];
var strOfficeKey = arrOfficeKeyList[j];
var strRights = arrRghtsTypeList[j];
var rowOrgPos = document.createElement("TR");
var cellOrgPos = document.createElement("TD");
var strOrgPosLabel = document.createTextNode(strPos);

cellOrgPos.appendChild(strOrgPosLabel);
rowOrgPos.appendChild(cellOrgPos);
/*add day events*/
for (l=1; l<8; l++)
{
cellDayEvent = document.createElement("TD");
cellDayEvent.setAttribute("width", "11%");
cellDayEvent.setAttribute("align", "center");

var activeDate =
week[l].getMonth()+"/"+week[l].getDate()+"/"+week[l].getYear();
strLocation = "X";
cellColor = stripeColor;
var leaveType = "";

for (k=0; k<arrOfficeKeyListTwo.length; k++)
{
if ((arrOfficeKeyListTwo[k] ==
strOfficeKey)&&(arrActiveDateList[k]==activeDate))
{
strLocation = arrLocationList[k];
leaveType = arrLeaveTypeList[k];
}
}

if (leaveType == "TDY")
{
cellColor = "blue";
}
if (leaveType == "Leave")
{
cellColor = "red";
}

cellDayEvent.style.backgroundColor = cellColor;

if (strRights == "Editor")
{
var aEvent = document.createElement("a");
aEvent.href =
"editActivity.asp?strOfficeKey="+strOfficeKey+"&st rDate="+activeDate;
var strLabel = document.createTextNode(strLocation);
aEvent.appendChild(strLabel);
cellDayEvent.appendChild(aEvent);
activeComments = "yes";
}
else
{
var strLabel = document.createTextNode(strLocation);
cellDayEvent.appendChild(strLabel);
}

rowOrgPos.appendChild(cellDayEvent);
}
/*end day events*/

tbodyOrgToAdd.appendChild(rowOrgPos);
}

}
/*add org comment box*/
var activeWeekBegins =
week[1].getMonth()+"/"+week[1].getDate()+"/"+week[1].getYear();
var strComments = "test";
for (m=0; m<arrOrgListTwo.length; m++)
{
if ((arrOrgListTwo[m] ==
strOrg)&&(arrActiveDateListTwo[m]==activeWeekBegins))
{
strComments = arrDescriptionList[m];
}
}

if (activeComments == "yes")
{
var rowCommentBox = document.createElement("TR");
var cellCommentBox = document.createElement("TD");
var strCellTbleFrmCommentBoxLabel =
document.createTextNode("comment:");
cellCommentBox.appendChild(strCellTbleFrmCommentBo xLabel);
rowCommentBox.appendChild(cellCommentBox);

var cellCommentBoxFrm = document.createElement("TD");
cellCommentBoxFrm.colSpan = "7";
var frmCommentBox = document.createElement("FORM");
frmCommentBox.setAttribute("id", strOrg);
var txtbxCellTbleFrmCommentBoxTxtBx =
document.createElement("INPUT");
txtbxCellTbleFrmCommentBoxTxtBx.type = "text";
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("onch ange",
ChangeComment);
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("widt h", "1000");
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("heig ht", "50");
var hdnCellTbleFrmCommentBoxTxtBx =
document.createElement("INPUT");
hdnCellTbleFrmCommentBoxTxtBx.type = "hidden";
hdnCellTbleFrmCommentBoxTxtBx.value = strOrg;

frmCommentBox.appendChild(txtbxCellTbleFrmCommentB oxTxtBx);
frmCommentBox.appendChild(hdnCellTbleFrmCommentBox TxtBx);
cellCommentBoxFrm.appendChild(frmCommentBox);
rowCommentBox.appendChild(cellCommentBoxFrm);
tbodyOrgToAdd.appendChild(rowCommentBox);
}
else
{
var rowCommentBox = document.createElement("TR");
rowCommentBox.setAttribute("colspan", "8");
var cellCommentBoxLabel = document.createElement("TD");
strCommentBoxLabel = document.createTextNode("comment:");
var cellCommentBoxText = document.createElement("TD");
strCommentBoxText = document.createTextNode(strComments);

cellCommentBoxLabel.appendChild(strCommentBoxLabel );
rowCommentBox.appendChild(cellCommentBoxLabel);
cellCommentBoxText.appendChild(strCommentBoxText);
rowCommentBox.appendChild(cellCommentBoxText);
tbodyOrgToAdd.appendChild(rowCommentBox);
}

/*end org comment box*/
tableOrgToAdd.appendChild(tbodyOrgToAdd);
cellOrgMainTable.appendChild(tableOrgToAdd);
rowOrgMainTable.appendChild(cellOrgMainTable);
bodyOrgMainTable.appendChild(rowOrgMainTable);

stripecolor = "#CCCCCC";
}

</script>

</body>
</html>
Jul 23 '05 #1
3 1623
On 17 May 2004 12:18:36 -0700, NewmanBT wrote:
As you can see from the code below, ...
What I can see from that code is that you
need some pointers with trimming your
code for public viewing.

<http://www.physci.org/codes/sscce.jsp>
More directed to Java, but explains some
principles and tips for trimming and presenting
any programming language or mark-up/styles.
(further comment below)
Select Case WeekDay (dtmActiveDate)
Case 1
dtmActiveDate = DateAdd("d", -6, dtmActiveDate)
Case 2
Case 3
dtmActiveDate = DateAdd("d", -1, dtmActiveDate)
Case 4
dtmActiveDate = DateAdd("d", -2, dtmActiveDate)
Case 5
dtmActiveDate = DateAdd("d", -3, dtmActiveDate)
Case 6
dtmActiveDate = DateAdd("d", -4, dtmActiveDate)
Case 7
dtmActiveDate = DateAdd("d", -5, dtmActiveDate)
End Select


For example..
Can you get your example to fail with
only Case 1 & Case 3 present? If so,
why are the rest even mentioned?

etc.

[ Trimming often reveals the problem
as well.. read the link. ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Jul 23 '05 #2
Hopefully this will clarify the problem
(sorry about the code dump earlier, I posted a problem here before and
someone requested to see the entire code - I thought doing that now
would save some time)
I can't, unfortunately, post a link to the page as its on an intranet.

<! DOCTYPE HTML PUBLIC "=//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Report</title>
<link href="exec.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body>
<table id = "tblAvailReport" border="1">
</table>
<script language="JavaScript">
var row = new Array("DO", "LO");
function ChangeComment()
{
var thisOrg = strOrg;
var orgFrmComment =
document.getElementById(thisOrg).getElementsByTagN ame("INPUT")[0];
alert ("org = "+thisOrg);
alert("comment = "+orgFrmComment.value);
alert("date = "+activeWeekBegins);
window.location.replace("submitComments.asp?org="+ thisOrg+"&strComments
="+orgFrmComment.value+"&Date="+activeWeekBegin s);
}
var arrOrgListTwo = new Array();
var arrDescriptionList = new Array();
var arrActiveDateListTwo = new Array();

var month = 5
var month = month - 1
var day = 17
var year = 2004
var today = new Date(year, month, day);

var week = new Array(7);
week[1] = today;
/*row = ("DO", "LO");*/

var tblOrgMainTable = document.getElementById("tblAvailReport");
var headerOrgMainTable = document.createElement("THEAD");
var rowHeaderOrgMainTable = document.createElement("TR");
var cellHeaderOrgMainTable = document.createElement("TH");
cellHeaderOrgMainTable.setAttribute("width", "25%");
var strHeaderOrgMainTableLabel = document.createTextNode
("Org/Position");

for (i=0; i<row.length; i++)
{
var strOrg = row[i];

var bodyOrgMainTable =
document.getElementById("tblAvailReport").getEleme ntsByTagName("TBODY")[
0];
var rowOrgMainTable = document.createElement("TR");
var cellOrgMainTable = document.createElement("TD");
cellOrgMainTable.colSpan = "8";
var tableOrgToAdd = document.createElement("TABLE");
tableOrgToAdd.setAttribute("border", "1");
tableOrgToAdd.setAttribute("width", "100%");
var tbodyOrgToAdd = document.createElement("TBODY");
var rowOrgHeader = document.createElement("TR");
var cellOrgHeader = document.createElement("TD");
cellOrgHeader.setAttribute("width", "25%");
var strOrgLabel = document.createTextNode(strOrg);
/*var strOrgLabel = document.createTextNode("tester");*/

cellOrgHeader.appendChild(strOrgLabel);
rowOrgHeader.appendChild(cellOrgHeader);
tbodyOrgToAdd.appendChild(rowOrgHeader);
var activeComments = "no";

/*add org comment box*/
var activeWeekBegins =
week[1].getMonth()+"/"+week[1].getDate()+"/"+week[1].getYear();
var strComments = "test";
for (m=0; m<arrOrgListTwo.length; m++)
{
if ((arrOrgListTwo[m] ==
strOrg)&&(arrActiveDateListTwo[m]==activeWeekBegins))
{
strComments = arrDescriptionList[m];
}
}
activeComments = "yes"
if (activeComments == "yes")
{
var rowCommentBox = document.createElement("TR");
var cellCommentBox = document.createElement("TD");
var strCellTbleFrmCommentBoxLabel =
document.createTextNode("comment:");
cellCommentBox.appendChild(strCellTbleFrmCommentBo xLabel);
rowCommentBox.appendChild(cellCommentBox);

var cellCommentBoxFrm = document.createElement("TD");
cellCommentBoxFrm.colSpan = "7";
var frmCommentBox = document.createElement("FORM");
frmCommentBox.setAttribute("id", strOrg);
var txtbxCellTbleFrmCommentBoxTxtBx =
document.createElement("INPUT");
txtbxCellTbleFrmCommentBoxTxtBx.type = "text";
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("onch ange",
ChangeComment);
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("widt h", "1000");
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("heig ht", "50");
var hdnCellTbleFrmCommentBoxTxtBx = document.createElement("INPUT");
hdnCellTbleFrmCommentBoxTxtBx.type = "hidden";
hdnCellTbleFrmCommentBoxTxtBx.value = strOrg;

frmCommentBox.appendChild(txtbxCellTbleFrmCommentB oxTxtBx);
frmCommentBox.appendChild(hdnCellTbleFrmCommentBox TxtBx);
cellCommentBoxFrm.appendChild(frmCommentBox);
rowCommentBox.appendChild(cellCommentBoxFrm);
tbodyOrgToAdd.appendChild(rowCommentBox);
}
else
{
var rowCommentBox = document.createElement("TR");
rowCommentBox.setAttribute("colspan", "8");
var cellCommentBoxLabel = document.createElement("TD");
strCommentBoxLabel = document.createTextNode("comment:");
var cellCommentBoxText = document.createElement("TD");
strCommentBoxText = document.createTextNode(strComments);

cellCommentBoxLabel.appendChild(strCommentBoxLabel );
rowCommentBox.appendChild(cellCommentBoxLabel);
cellCommentBoxText.appendChild(strCommentBoxText);
rowCommentBox.appendChild(cellCommentBoxText);
tbodyOrgToAdd.appendChild(rowCommentBox);
}

/*end org comment box*/
tableOrgToAdd.appendChild(tbodyOrgToAdd);
cellOrgMainTable.appendChild(tableOrgToAdd);
rowOrgMainTable.appendChild(cellOrgMainTable);
bodyOrgMainTable.appendChild(rowOrgMainTable);

stripecolor = "#CCCCCC";
}

</script>

</body>
</html>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3
Hopefully this clears up the nature of the problem.
my comment boxes aren't updating correctly because I can't set thisOrg
to each Org's name
I can't provide a hyperlink because this is on an intranet.

<! DOCTYPE HTML PUBLIC "=//W3C//DTD HTML 4.01 Transitional//EN">

<html>

<head>
<title>Report</title>
<link href="exec.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">

</head>

<body>
<table id = "tblAvailReport" border="1">
</table>
<script language="JavaScript">
var row = new Array("DO", "LO");
function ChangeComment()
{
var thisOrg = strOrg;
var orgFrmComment =
document.getElementById(thisOrg).getElementsByTagN ame("INPUT")[0];
alert ("org = "+thisOrg);
alert("comment = "+orgFrmComment.value);
alert("date = "+activeWeekBegins);
window.location.replace("submitComments.asp?org="+ thisOrg+"&strComments="+orgFrmComment.value+"&Date ="+activeWeekBegins);
}
var arrOrgListTwo = new Array();
var arrDescriptionList = new Array();
var arrActiveDateListTwo = new Array();

var month = 5
var month = month - 1
var day = 17
var year = 2004
var today = new Date(year, month, day);

var week = new Array(7);
week[1] = today;
/*row = ("DO", "LO");*/

var tblOrgMainTable = document.getElementById("tblAvailReport");
var headerOrgMainTable = document.createElement("THEAD");
var rowHeaderOrgMainTable = document.createElement("TR");
var cellHeaderOrgMainTable = document.createElement("TH");
cellHeaderOrgMainTable.setAttribute("width", "25%");
var strHeaderOrgMainTableLabel = document.createTextNode
("Org/Position");

for (i=0; i<row.length; i++)
{
var strOrg = row[i];

var bodyOrgMainTable =
document.getElementById("tblAvailReport").getEleme ntsByTagName("TBODY")[0];
var rowOrgMainTable = document.createElement("TR");
var cellOrgMainTable = document.createElement("TD");
cellOrgMainTable.colSpan = "8";
var tableOrgToAdd = document.createElement("TABLE");
tableOrgToAdd.setAttribute("border", "1");
tableOrgToAdd.setAttribute("width", "100%");
var tbodyOrgToAdd = document.createElement("TBODY");
var rowOrgHeader = document.createElement("TR");
var cellOrgHeader = document.createElement("TD");
cellOrgHeader.setAttribute("width", "25%");
var strOrgLabel = document.createTextNode(strOrg);
/*var strOrgLabel = document.createTextNode("tester");*/

cellOrgHeader.appendChild(strOrgLabel);
rowOrgHeader.appendChild(cellOrgHeader);
tbodyOrgToAdd.appendChild(rowOrgHeader);
var activeComments = "no";

/*add org comment box*/
var activeWeekBegins =
week[1].getMonth()+"/"+week[1].getDate()+"/"+week[1].getYear();
var strComments = "test";
for (m=0; m<arrOrgListTwo.length; m++)
{
if ((arrOrgListTwo[m] ==
strOrg)&&(arrActiveDateListTwo[m]==activeWeekBegins))
{
strComments = arrDescriptionList[m];
}
}
activeComments = "yes"
if (activeComments == "yes")
{
var rowCommentBox = document.createElement("TR");
var cellCommentBox = document.createElement("TD");
var strCellTbleFrmCommentBoxLabel =
document.createTextNode("comment:");
cellCommentBox.appendChild(strCellTbleFrmCommentBo xLabel);
rowCommentBox.appendChild(cellCommentBox);

var cellCommentBoxFrm = document.createElement("TD");
cellCommentBoxFrm.colSpan = "7";
var frmCommentBox = document.createElement("FORM");
frmCommentBox.setAttribute("id", strOrg);
var txtbxCellTbleFrmCommentBoxTxtBx =
document.createElement("INPUT");
txtbxCellTbleFrmCommentBoxTxtBx.type = "text";
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("onch ange",
ChangeComment);
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("widt h", "1000");
txtbxCellTbleFrmCommentBoxTxtBx.setAttribute("heig ht", "50");
var hdnCellTbleFrmCommentBoxTxtBx =
document.createElement("INPUT");
hdnCellTbleFrmCommentBoxTxtBx.type = "hidden";
hdnCellTbleFrmCommentBoxTxtBx.value = strOrg;

frmCommentBox.appendChild(txtbxCellTbleFrmCommentB oxTxtBx);
frmCommentBox.appendChild(hdnCellTbleFrmCommentBox TxtBx);
cellCommentBoxFrm.appendChild(frmCommentBox);
rowCommentBox.appendChild(cellCommentBoxFrm);
tbodyOrgToAdd.appendChild(rowCommentBox);
}
else
{
var rowCommentBox = document.createElement("TR");
rowCommentBox.setAttribute("colspan", "8");
var cellCommentBoxLabel = document.createElement("TD");
strCommentBoxLabel = document.createTextNode("comment:");
var cellCommentBoxText = document.createElement("TD");
strCommentBoxText = document.createTextNode(strComments);

cellCommentBoxLabel.appendChild(strCommentBoxLabel );
rowCommentBox.appendChild(cellCommentBoxLabel);
cellCommentBoxText.appendChild(strCommentBoxText);
rowCommentBox.appendChild(cellCommentBoxText);
tbodyOrgToAdd.appendChild(rowCommentBox);
}

/*end org comment box*/
tableOrgToAdd.appendChild(tbodyOrgToAdd);
cellOrgMainTable.appendChild(tableOrgToAdd);
rowOrgMainTable.appendChild(cellOrgMainTable);
bodyOrgMainTable.appendChild(rowOrgMainTable);

stripecolor = "#CCCCCC";
}

</script>

</body>
</html>
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Ryan McGeary | last post by:
In a <select> drop-down, the onchange event isn't called when scrolling through the dropdown using the mouse-wheel and when crossing over a new <optgroup>. Using the example below, notice how...
3
by: Dennis M. Marks | last post by:
I have a problem with the following code. It generates a <FORM><SELECT><OPTION> list. There is no problem in the generating. The problem is in the execution as follows. It works fine in Mac IE...
1
by: dan baker | last post by:
I am pretty much a newbie with javascript, and would like to get a little clarification on what I can do with an onChange javascript event handler. I have a dynamic page I build with perl and...
4
by: Bart van Deenen | last post by:
Hi all I have a script where I dynamically create multiple inputs and selects from a script. The inputs and selects must have an associated onchange handler. I have the script working fine on...
13
by: aundro | last post by:
Hello, I've been looking on the web for a solution to this problem: I create a set of checkboxes, and 2 buttons: - one is labeled "All" - the other is labeled "None" Clicking "All" is...
4
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is...
1
by: MDBloemker | last post by:
can anyone help me fathom out how to use this bit of code: Public Class Utilities Public Shared Sub CreateConfirmBox(ByRef txt As WebControls.TextBox, _ ByVal strMessage As String)...
5
by: J | last post by:
I am having problems dynamically adding more than one event handler to an input. I have tried the Javascript included at the bottom. The lines inp.attachEvent('onkeyup',...
4
by: auslandt | last post by:
I have an HTML file that includes a JavaScript. I would like this JavaScript to be able to create an "onChange=<function>" attribute against the password element. Here is an example page of the...
3
by: HugeBob | last post by:
Hi All, I'm creating textareas via the DOM and I'm trying to add the onchange event to them. Here's my code: mytextarea = document.createElement("textarea"); mytextarea.onchange = mymethod;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.