Problem with form validation

M

mosow

I have a form that I have created using FP 2000. I change the text
box to validate the entry. When bringing up the page in my browser
from our web server, I get the following message:

'DB1' is null or not an object

This is the name of the field I am trying to validate.

Any idea on why this is happening and how to correct?

TIA
 
J

Jim Buyens

Can you provide a URL?

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
M

mosow

I can not give you a URL as this is part of an internal site. The
code is below, generated by FrontPage:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Release Date Comparison</title>
</head>

<body>

<p align="left"><font face="Arial Black" color="#008080"><a
href="rms_reports.htm">Return
to Report Menu</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</font><font
size="2">&nbsp;&nbsp;&nbsp;</font>&nbsp;&nbsp;&nbsp;&nbsp;
<font size="2">Date: <script language="VBScript">
document.write(FormatDateTime(Date(),0))</script>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Time: <script language="VBScript">
document.write(FormatDateTime(Time(),0))</script>
</font></p>
<p align="center"><font size="7" face="Comic Sans MS"
color="#FF0066"><i><b><u>Release
Date Comparison</u></b></i></font></p>

<script Language="JavaScript">
function FrontPage_Form1_Validator(theForm)
{

var checkOK = "0123456789-.,";
var checkStr = theForm.DB1.value;
var allValid = true;
var decPoints = 0;
var allNum = "";
for (i = 0; i < checkStr.length; i++)
{
ch = checkStr.charAt(i);
for (j = 0; j < checkOK.length; j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch == ".")
{
allNum += ".";
decPoints++;
}
else if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"DB1\" field.");
theForm.DB1.focus();
return (false);
}

if (decPoints > 1)
{
alert("Please enter a valid number in the \"DB1\" field.");
theForm.DB1.focus();
return (false);
}
return (true);
}
//--></script>

<form BOTID="0" METHOD="POST" ACTION="DateComparison1.asp"
onsubmit="return FrontPage_Form1_Validator(this)"
name="FrontPage_Form1">
<table BORDER="0">
<tr>
<td><b>Prior Database:</b></td>
<td><!--webbot bot="Validation" S-Data-Type="Number"
S-Number-Separators=",." --><input NAME="DB1"
VALUE="<%=Request("DB1")%>" size="20"></td>
</tr>
<tr>
<td><b>Prior Release:</b></td>
<td><input NAME="PV1" VALUE="<%=Request("PV1")%>"
size="20"></td>
</tr>
<tr>
<td><b>Current Database:</b></td>
<td><input NAME="DB2" VALUE="<%=Request("DB2")%>"
size="20"></td>
</tr>
<tr>
<td><b>Current Release:</b></td>
<td><input NAME="PV2" VALUE="<%=Request("PV2")%>"
size="20"></td>
</tr>
</table>
<br>
<input TYPE="Submit"><input TYPE="Reset"><!--webbot bot="SaveAsASP"
CLIENTSIDE
SuggestedExt="asp" PREVIEW=" " -->
</form>
<table width="815" border="1">
<thead>
<tr>
<td width="155"><b>Object Family</b></td>
<td width="58" align="left"><b>Object</b></td>
<td width="71" align="center"><b>Prior<br>
Database</b></td>
<td width="62" align="center"><b>Prior<br>
Version</b></td>
<td width="102" align="center"><b>Prior Date<br>
Compiled</b></td>
<td width="71" align="center"><b>Current<br>
Database</b></td>
<td width="62" align="center"><b>Current<br>
Version</b></td>
<td width="102" align="center"><b>Current&nbsp; Date<br>
&nbsp;Compiled</b></td>
<td width="104" align="center"><b>Host<br>
System</b></td>
</tr>
</thead>
<tbody>
<!--webbot bot="DatabaseRegionStart" startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-columntypes="200,200,2,200,200,2,200,200,200,200"
s-dataconnection="RMS97"
b-tableformat="TRUE" b-menuformat="FALSE" s-menuchoice="Object
Family Name"
s-menuvalue="Object Family Name" b-tableborder="TRUE"
b-tableexpand="TRUE"
b-tableheader="TRUE" b-listlabels="TRUE" b-listseparator="TRUE"
i-ListFormat="0" b-makeform="TRUE"
s-recordsource="Date_Compare_Single"
s-displaycolumns="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem"
s-criteria="{Database Release 1} EQ {DB1} + {Product Version 1} EQ
{PV1} + {Database Release 2} EQ {DB2} + {Product Version 2} EQ {PV2}
+"
s-order
s-sql="SELECT * FROM Date_Compare_Single WHERE (&amp;quot;Database
Release 1&amp;quot; = ::DB1:: AND &amp;quot;Product Version
1&amp;quot; = ::pV1:: AND &amp;quot;Database Release 2&amp;quot; =
::DB2:: AND &amp;quot;Product Version 2&amp;quot; = ::pV2::)"
b-procedure="FALSE" clientside SuggestedExt="asp"
s-DefaultFields="DB1=0&amp;amp;PV1=0&amp;amp;DB2=0&amp;amp;PV2=0"
s-NoRecordsFound="No records returned." i-MaxRecords="0"
i-GroupSize="0"
BOTID="0" u-dblib="_fpclass/fpdblib.inc"
u-dbrgn1="_fpclass/fpdbrgn1.inc"
u-dbrgn2="_fpclass/fpdbrgn2.inc" tag="TBODY"
local_preview="&lt;tr&gt;&lt;td colspan=64
bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot;
width=&quot;100%&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;Database Results regions will not preview
unless this page is fetched from a Web server with a web browser. The
following table row will repeat once for every record returned by the
query.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;This is the start of a Database Results
region. The page must be fetched from a web server with a web browser
to display correctly; the current web is stored on your local disk or
network.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
b-WasTableFormat="TRUE" b-ReplaceDatabaseRegion="FALSE"
--><!--#include file="_fpclass/fpdblib.inc"-->
<%
fp_sQry="SELECT * FROM Date_Compare_Single WHERE (""Database Release
1"" = ::DB1:: AND ""Product Version 1"" = ::pV1:: AND ""Database
Release 2"" = ::DB2:: AND ""Product Version 2"" = ::pV2::)"
fp_sDefault="DB1=0&PV1=0&DB2=0&PV2=0"
fp_sNoRecords="<tr><td colspan=9 align=left width=""100%"">No records
returned.</td></tr>"
fp_sDataConn="RMS97"
fp_iMaxRecords=0
fp_iCommandType=1
fp_iPageSize=0
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice="Object Family Name"
fp_sMenuValue="Object Family Name"
fp_iDisplayCols=9
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>
<!--#include file="_fpclass/fpdbrgn1.inc"-->
<!--webbot bot="DatabaseRegionStart" i-CheckSum="17107" endspan -->
<tr>
<td width="155"><!--webbot bot="DatabaseResultColumn" startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Object Family Name" b-tableformat="TRUE"
b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Object Family
Name&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Object Family
Name&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Object Family Name")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="51362" endspan -->
</td>
<td width="58" align="left"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Object Name" b-tableformat="TRUE" b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Object
Name&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Object
Name&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Object Name")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="27162" endspan -->
</td>
<td width="71" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Database Release 1" b-tableformat="TRUE"
b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Database Release
1&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Database Release
1&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Database Release 1")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="34652" endspan -->
</td>
<td width="62" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Product Version 1" b-tableformat="TRUE"
b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Product Version
1&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Product Version
1&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Product Version 1")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="38023" endspan -->
</td>
<td width="102" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Enterprise Date Compiled 1" b-tableformat="TRUE"
b-hasHTML="FALSE" clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Enterprise Date
Compiled 1&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Enterprise Date
Compiled 1&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Enterprise Date Compiled 1")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="1376" endspan -->
</td>
<td width="71" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Database Release 2" b-tableformat="TRUE"
b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Database Release
2&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Database Release
2&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Database Release 2")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="34780" endspan -->
</td>
<td width="62" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Product Version 2" b-tableformat="TRUE"
b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Product Version
2&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Product Version
2&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Product Version 2")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="38087" endspan -->
</td>
<td width="102" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="Enterprise Date Compiled 2" b-tableformat="TRUE"
b-hasHTML="FALSE" clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Enterprise Date
Compiled 2&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;Enterprise Date
Compiled 2&lt;font size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"Enterprise Date Compiled 2")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="1504" endspan -->
</td>
<td width="104" align="center"><!--webbot
bot="DatabaseResultColumn"
startspan
s-columnnames="Object Family Name,Object Name,Database Release
1,Product Version 1,Enterprise Date Compiled 1,Database Release
2,Product Version 2,Enterprise Date Compiled 2,HostSystem,HostSystem"
s-column="HostSystem" b-tableformat="TRUE" b-hasHTML="FALSE"
clientside
local_preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;HostSystem&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
preview="&lt;font
size=&quot;-1&quot;&gt;&amp;lt;&amp;lt;&lt;/font&gt;HostSystem&lt;font
size=&quot;-1&quot;&gt;&amp;gt;&amp;gt;&lt;/font&gt;"
--><%=FP_FieldVal(fp_rs,"HostSystem")%><!--webbot
bot="DatabaseResultColumn" i-CheckSum="30332" endspan -->
</td>
</tr>
<!--webbot bot="DatabaseRegionEnd" startspan b-tableformat="TRUE"
b-menuformat="FALSE" u-dbrgn2="_fpclass/fpdbrgn2.inc"
i-groupsize="0"
clientside tag="TBODY"
local_preview="&lt;tr&gt;&lt;td colspan=64
bgcolor=&quot;#FFFF00&quot; align=&quot;left&quot;
width=&quot;100%&quot;&gt;&lt;font color=&quot;#000000&quot;&gt;This
is the end of a Database Results
region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;"
preview="&lt;tr&gt;&lt;td colspan=64 bgcolor=&quot;#FFFF00&quot;
align=&quot;left&quot; width=&quot;100%&quot;&gt;&lt;font
color=&quot;#000000&quot;&gt;This is the end of a Database Results
region.&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;" --><!--#include
file="_fpclass/fpdbrgn2.inc"-->
<!--webbot bot="DatabaseRegionEnd" i-CheckSum="62730" endspan -->
</tbody>
</table>

</body>

</html>
 
J

Jim Buyens

I can't reproduce your entire setup because I don't have the
databases and other required files. However, when I copied
and pasted your code for the 'DB1' element, it worked fine.

Do you have script debugging turned on in IE? If not, turn it
on, then reproduce the error situation, then choose that Yes,
you want to enter the debugger. When prompted, choose Break,
and then the debugger will show you exactly which statement
is failing.

To turn on script debugging in IE, choose Tools, Internet Options,
Advanced. Then, under Browsing, clear Disable Script Debugging.

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
M

mosow

I appreciate your looking at this for me. The line that I get the
error on is:

var checkStr = theForm.DB1.value;

I am not a javascript person. So I am relying on FrontPage to be
smart enough to generate all the code I need to make this work.
 
M

mosow

Thanks for looking at this. The line that it fails on is:

var checkStr = theForm.DB1.value;
 
Top