Bottom half of the ASP
[tt]
[red]
generates the Tabel cells you seen above into a string that is used at the bottom of this ASP
showtreeat AryData, 0,0, "" 'stores Database into HTML formats[/red]
set LangData = nothing
Set ESA = nothing
Set RM = nothing
Set Occ = nothing
set IOC = nothing
' Start of HTML Response
%>
<Script language="Javascript">
<!--
var max = <%=ubound(AryData,2)%>
tree = new Array(<%=ubound(AryData,2)+1%>);
var spnum = 0
function spaces(number)
{
var sptmp = '';
for (var sp=0; sp<number; sp++)
sptmp = sptmp + " ";
return sptmp;
}
function createRow(HID, LID, HName, HP, LP)
{
nary = new Array(5);
nary[0] = HID;
nary[1] = LID;
nary[2] = HName;
nary[3] = HP;
nary[4] = LP;
return nary;
}
function I plan to make all children checked when parent is checked
function ShowChild(HID, LID)
{
var list = '';
for(var j=0; j<=max; j++)
{
if ((tree[j][3] == HID) & (tree[j][4] == LID))
{
//Need to figure out how to reference an object using it's name in a String
spnum += 1;
retshow = ShowChild(tree[j][0],tree[j][1])
spnum -= 1;
if (retshow != '')
list = list + "\n" + spaces(spnum) + tree[j][2] + retshow;
else
list = list + "\n" + spaces(spnum) + tree[j][2];
}
}
return list;
}
<%
for j = lbound(AryData, 2) to ubound(AryData,2)
Response.Write "tree[" & j & "] = createRow(" & AryData(HID,j) & "," & AryData(LID,j) & ",""" & AryData(Name,j) & """," & AryData(HP,j) & "," & AryData(LP,j) & "

;" & vbcrlf
next
%>
-->
</Script>
<%
set AryData = nothing
Response.write "<form action=""FormatMulti.asp"" method=""Post"">" & vbcrlf
Response.Write vbtab & "<Table border=0 align=center Width=""90%"">" & vbcrlf
Response.Write vbtab & vbtab & "<TR><TD " & gTopColor & " align=center valign=middle colspan=2> <H1> " & LangLookup("Multi", "Report", "Print"

& "</H1> </TD></TR>" & vbcrlf
Response.Write vbtab & vbtab & "<TR>" & vbcrlf
'Output of Table cells showing checkboxes, etc
Response.Write vbtab & vbtab & vbtab & "<TD " & gTableCellColor & " width=""50%"" valign=top><Table border=0 width=""100%"">" & vbcrlf & HTMLStr1 & vbcrlf & "</Table></TD>" & vbcrlf
Response.Write vbtab & vbtab & vbtab & "<TD " & gTableCellColor & " width=""50%"" valign=top><Table border=0 width=""100%"">" & vbcrlf & HTMLStr & vbcrlf & "</Table></TD>" & vbcrlf
'Rest HTML response
Response.Write vbtab & vbtab & "</TR>" & vbcrlf
Response.Write vbtab & vbtab & "<TR><TD " & gBottomColor & " align=center valign=middle colspan=2><input type=""Submit""></TD></TR>" & vbcrlf
Response.Write vbtab & "</Table>" & vbcrlf
Response.Write "</form>" & vbcrlf
Response.write "</body>" & vbcrlf & "</html>"
Response.Flush
Response.End
%>
[/tt]
a portion of the showtreeat() function.
[tt]
'<!-- Rescursive Subroutine with starting point -->
sub showtreeat(byref theObj, HpLoc, LpLoc, PName) 'Rescurvily loads tree into HTMLStr1 and HTMLStr
Dim TreeRow
TreeRow = UBound(theObj, 2)
for j = 0 to TreeRow
If theObj(HP,j) = HpLoc and theObj(LP,j) = LpLoc then
'-----------------------------------------------------
'If this is a child of the parent we are searching for
if Change = true then
'Begining of Start second column HTML
If Spaces = 0 then
If count > 45 then
Change = False
HTMLStr1 = HTMLStr
HTMLStr = ""
end if
end if
'End of 2nd HTML
end if
if theObj(RType,j) <> "DataGroup" then
If Spaces = 0 then
HTMLStr = HTMLStr & "<TR><TD " & gHeader2CellColor & ">"
else
HTMLStr = HTMLStr & "<TR><TD " & gTableCellColor & ">"
end if
if Pname = "" then 'will be modified when we need to find parents of children
[red] HTMLStr = HTMLStr & writetabs(Spaces) & vbcrlf & "<input onclick=""javascript:alert(ShowChild(" & TheObj(HID,j) & "," & TheObj(LID,j) & "

)"" type=""" & TheObj(RType, j) & """ name=""" & TheObj(Name, j) & """ value=""" & TheObj(Value,j) & """>" [/red]
else
[red] HTMLStr = HTMLStr & writetabs(Spaces) & vbcrlf & "<input onclick=""javascript:alert(ShowChild(" & TheObj(HID,j) & "," & TheObj(LID,j) & "

)"" type=""" & TheObj(RType, j) & """ name=""" & TheObj(Name, j) & """ value=""" & TheObj(Value,j) & """>" [/red]
end if
HTMLStr = HTMLStr & TheObj(Label, j)
HTMLStr = HTMLStr & "</TD></TR>" & vbcrlf & vbcrlf
Count = Count + 1
else
....
[/tt]
It would be somewhat difficult, because the list of Checkboxes, and what not in a tree format, comes from an Array generated by .GetRows from a Database, that hold certain header/left etc data to recursivily give the flow a true parent/child relation(a true parent/child is no longer true when it becoems an HTML) [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href=
</a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]