This is page2 of the code Tarwn helped out with.
Tarwn helped with page1 of it.
This code works fine as far as doing what I wanted it to do.
However, the only issue that I have is the layout.
I have been struggling to re-arrange it but to avail.
I would like the layout to look like this:
Fullname:______________ System ID:______ Project No:____
From/At:______________ To:________ No. of Segments:____
Then the other formats can stay as they are:
So far it isn't working.
One other *little* problem is that the "Next Block" functionality is not working.
Any help would be greatly appreciated.
Sorry about the long code:
Tarwn helped with page1 of it.
This code works fine as far as doing what I wanted it to do.
However, the only issue that I have is the layout.
I have been struggling to re-arrange it but to avail.
I would like the layout to look like this:
Fullname:______________ System ID:______ Project No:____
From/At:______________ To:________ No. of Segments:____
Then the other formats can stay as they are:
So far it isn't working.
One other *little* problem is that the "Next Block" functionality is not working.
Any help would be greatly appreciated.
Sorry about the long code:
Code:
<%
' from the prior page, we get the requested SystemID:
systemID = Request("TxtsysID")
full_Name = Request("TxtprojectName")
dim Conn,SQLstr
Function OpenDBFConn(Path)
Dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Path & ";" & _
"Extended Properties=""DBASE IV;"";"
Set OpenDBFConn = Conn
End Function
Dim DBConn
Set DBConn = OpenDBFConn("c:\arcgis")
'Open recordset from basins table
Dim rs
Set rs = DBConn.Execute("SELECT Full_Name, geo_oid FROM cline.dbf where system_ID =" & SystemID)
' How many rows are there?
BlockCount = UBound(rows,2) + 1
' okay, ready to generate form...
%>
<FORM Name="MainForm" Method=Post Action="sam2.asp" onFilt="return validateForm(this);">
<INPUT Type=HIDDEN Name="blockCount" Value="<%=blockCount%>" >
<INPUT Type=HIDDEN Name="systemID" Value="<%=systemID%>" >
<table CellPadding=5>
<tr>
<td align="right">System ID:</td>
<td><%=systemID%></td>
<td align="right">Project No:</td>
<td><input type="text" size=5 name="projID" value=""></td>
</tr>
<tr>
<td width="101"><font size="2" color="Black" face="Arial"><i>From/At:</i></font></td>
<td><input type="text" name="TxtfromAt" size="20" maxlength="20" value=""></td>
<td align="right"><font size="2" color="Black" face="Arial"><i>To:</i></font></td>
<td><input type="text" name="Txt_To" size="20" maxlength="20" value=""></td>
<td align="right"><font size="2" color="Black" face="Arial"><i>No. of Segments:</i></font></td>
<td><%=blockCount%></td>
</tr>
</table>
<hr>
<table CellPadding=5>
<tr>
<td colSpan=10>
Processing block <span ID="ID_curBlock">1</span>
of <%=blockCount%> blocks.
</td>
</tr>
<%
' now generate hidden divs for each row of data:
For row = 0 To UBound(rows,2)
full_Name = rows(COL_NAME,row)
geo_oid = rows(COL_BLKID,row)
%>
<INPUT Type=Hidden Name="Row_<%=row%>" Value="<%=blockID%>">
<INPUT Type=Hidden Name="Fullname_<%=row%>" Value="<%=fullName%>">
<tr ID="ROWA_<%=row%>" style="display: none">
<td>Block ID:</td>
<td><%=geo_oid%></td>
<td>Fullname:</td>
<td><%=full_Name%></td>
</tr>
<tr ID="ROWB_<%=row%>" style="display: none">
<td>From:</td>
<td><input type="text" size=10 name="from_<%=row%>" value=""></td>
<td>To:</td>
<td><input type="text" size=10 name="to_<%=row%>" value=""></td>
</tr>
<tr ID="ROWC_<%=row%>" style="display: none">
<td>Direction:</td>
<td><input type="text" size=5 name="direction_<%=row%>" value=""></td>
<td>To:</td>
<td><input type="text" size=5 name="directionTo_<%=row%>" value=""></td>
</tr>
<%
Next ' next row
%>
</TABLE>
<INPUT Type=Button Name="prior" Value="<<prior block" onFilt="goBlock(-1);">
<INPUT Type=Submit Value="Process Everything!">
<INPUT Type=Button Name="next" Value="next block>>" onFilt="goBlock(1);">
</FORM>
<SCRIPT Language="JavaScript">
// check one set of block info for validity
// This simple minded check just looks for blank values
// You get to fix it to do the right thing
//
function checkOne(which)
{
var frm = document.MainForm;
var fldFrom = frm.elements["from_" + which];
var fldTo = frm.elements["to_" + which];
var fldDir = frm.elements["direction_" + which];
var fldDirTo = frm.elements["directionTo_" + which];
if (fldFrom.value == "" || fldTo.value == ""
|| fldDir.value == "" || fldDirTo.value == "")
{
alert("Must fill in all info for block " + (1+which));
return false;
}
return true;
}
// and ditto this simple minded form validation
//
function validateForm(frm)
{
for (var block = 0; block < <%=blockCount%>; ++block)
{
if (!checkOne(block)) return false;
}
if (frm.projID.value == "")
{
alert("You must give a project id!");
return false;
}
return true;
}
var curBlock = 0;
// moves from blockID to blockID, hiding one and displaying next
function goBlock(whichWay)
{
var frm = document.MainForm;
var newBlock = curBlock + whichWay;
if (newBlock < 0 || newBlock >= <%=blockCount%>)
return; // can't go past ends
// warn if all info is not filled in
if ( whichWay != 0 ) // except when starting up
{
if (!checkOne(curBlock)) return;
}
var rowa, rowb, rowc;
// hide current row...
rowa = document.getElementById("ROWA_" + curBlock);
rowb = document.getElementById("ROWB_" + curBlock);
rowc = document.getElementById("ROWC_" + curBlock);
rowa.style.display = "none";
rowb.style.display = "none";
rowc.style.display = "none";
// move to requested row
curBlock = newBlock;
// and show it
rowa = document.getElementById("ROWA_" + curBlock);
rowb = document.getElementById("ROWB_" + curBlock);
rowc = document.getElementById("ROWC_" + curBlock);
rowa.style.display = "inline";
rowb.style.display = "inline";
rowc.style.display = "inline";
// and update which blockid is being worked on:
document.getElementById("ID_curBlock").innerText = (curBlock+1);
// disable prior/next if can't move more in that direction
frm.prior.disabled = (curBlock == 0);
frm.next.disabled = (curBlock >= <%=blockCount-1%>);
}
// and to get things started, call goBlock but don't move counter:
goBlock( 0 ); // with 0, nothing moves