I have a following form and need a help with the JavaScript function called SortValues(), please see my comments in the SortValues() function below. Many thanks!
<html>
<head>
<title>test</title>
<script language="javascript">
function verifySortOrder()
{
for(i=0; i < document.form1.txtOrder.le
ngth; i++)
{
if(isNaN(document.form1.tx
tOrder[i].
value) || document.form1.txtOrder[i]
.value == '')
{
alert('Sort Order must be a Numeric value');
return false;
}
}
document.form1.submit();
}
function SortValues(){
for(i=0; i < document.form1.txtOrder.le
ngth; i++)
{
// find the "txtOrder" input box where value is "0" and where "txtPublished" input box value is "latest date"
// check all the values in array of "txtOrder" input boxes to find the biggest number
// add "+1" to input box value where value is "0" so that latest "txtOrder" value becomes the highest number
}
}
</script>
</head>
<body onLoad="SortValues()">
<form action="Sort.asp">" method="post" name="form1">
<table width="650" border="0" cellspacing="3" cellpadding="3" id="fList">
<tr class="gHbgClr">
<td class="gridTitle">Publishe
d Date</td>
<td align="center" class="gridTitle">Sort Order</td>
</tr>
<%while not objectRecordSet.eof%>
<tr>
<td class="gridText ListBBrd"><input type="hidden" name="txtPublished" value="<%=objRecordSet("Pu
blishedDat
e")%>"></t
d>
<td class="gridText ListBBrd"><input type="text" name="txtOrder" value="<%=objectRecordSet(
"FSortOrde
r")%>"></t
d>
</tr>
<%objectRecordSet.movenext
wend%>
<tr>
<td colspan="3"> </td>
<td align="center" height="40"><input type="button" value="Submit"onClick="ver
ifySortOrd
er();"></t
d></tr>
</table>
</form>
</body>
</html>
Start Free Trial