By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,916 Members | 1,336 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,916 IT Pros & Developers. It's quick & easy.

need help with onChange event

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.