WHY, WHY, WHY!!!!! 
Author Message
 WHY, WHY, WHY!!!!!

Can anyone tell me what is wrong with this I have no idea why it doesnt work
I just keep getting the same errors up again and again.

ERROR: 'DOCUMENT.FRMSEARCH.P' IS NULL OR NOT AN OBJECT

This is the Javascript in the header!

<script language="javascript">
/*
Validate: Ensures legal search parameters have been entered.
*/
function Validate()
{
 var tOption = -1;
 for(i=0; i<document.frmSearch.t.length; i++)
 {
  if(document.frmSearch.t[i].checked)
  {
   tOption = i
  }
 }

 if(document.frmSearch.p.value.length > 0)
 {
  if(tOption == 3) // If searching by ID
  {
   if(isNum(document.frmSearch.p.value))
   {
    document.frmSearch.submit();
   }
   else
   {
    alert("ID can only be a number.");
    document.frmSearch.p.focus();
   }
  }
  else
  {
   document.frmSearch.submit();
  }
 }
 else
 {
  alert("Enter Search Parameter");
  document.frmSearch.p.focus();
 }

Quote:
}

/*
isNum: If searching by ID, checks if entered text is numeric.
*/
function isNum(txt)
{
 var validPhone = "0123456789";
 var temp;
 for (var i=0; i<txt.length; i++)
 {
  temp = txt.substring(i, i+1);
  if (validPhone.indexOf(temp) == "-1")
  {
   return false;
  }
 }
 return true;

Quote:
}

</script>
</head>
<body onLoad="JavaScript: buildPaths(); renderMenu('0', 0);
document.frmSearch.p.focus();" leftmargin="0" topmargin="0" marginwidth="0"
marginheight="0" bgcolor="#000000" text="#000000">

<<<<  HTML FORM  >>>>

<form name="frmSearch" action='<%= Request.ServerVariables("SCRIPT_NAME")
%>' method="get">
                                  <table border="0" width="450"
align="center" class="Txt_Body_Area">
                                    <tr>
                                      <td width="80" align="right"><b>Search
for:</b></td>
                                      <td width="200">
                                        <input type="text" name="p"
size="30" maxlength="100" value="<%=
Server.HTMLEncode(Request.QueryString("p")) %>">
                                      </td>
                                      <td width="70"
align="right"><b>Category</b>:</td>
                                      <td width="120" valign="top">
                                        <select size="1" name="c">
<%
strT = Request.QueryString("t")
%>
     <option value="All" <%
If (Request.QueryString("c") = "All") Or (Request.QueryString("c") = "") Or
(strT = "pageid") Then
 Response.Write ("selected")
 blnCatSet = True
End If %>>All</option>
     <option value="Article" <% If ((Request.QueryString("c") = "Article")
And (blnCatSet = False)) Then Response.Write ("selected")
%>>Article</option>
     <option value="Campaign" <% If ((Request.QueryString("c") = "Campaign")
And (blnCatSet = False)) then Response.Write ("selected")
%>>Campaign</option>
     <option value="Country" <% If ((Request.QueryString("c") = "Country")
And (blnCatSet = False)) then Response.Write ("selected")
%>>Country</option>
     <option value="Fundraising" <% If ((Request.QueryString("c") =
"Fundraising") And (blnCatSet = False)) then Response.Write ("selected")
%>>Fundraising</option>
     <option value="Overseas" <% If ((Request.QueryString("c") = "Overseas")
And (blnCatSet = False)) then Response.Write ("selected")
%>>Overseas</option>
     <option value="PressRelease" <% If ((Request.QueryString("c") =
"PressRelease") And (blnCatSet = False)) then Response.Write ("selected")
%>>Press Release</option>
     <option value="Publication" <% If ((Request.QueryString("c") =
"Publication") And (blnCatSet = False)) then Response.Write ("selected")
%>>Publication</option>
     <optgroup label="Files">
      <option value="Acrobat" <% If ((Request.QueryString("c") = "Acrobat")
And (blnCatSet = False)) then Response.Write ("selected")
%>>Acrobat</option>
      <option value="Excel" <% If ((Request.QueryString("c") = "Excel") And
(blnCatSet = False)) then Response.Write ("selected") %>>Excel</option>
      <option value="Photograph" <% If ((Request.QueryString("c") =
"Photograph") And (blnCatSet = False)) then Response.Write ("selected")
%>>Photograph</option>
      <option value="PowerPoint" <% If ((Request.QueryString("c") =
"PowerPoint") And (blnCatSet = False)) then Response.Write ("selected")
%>>PowerPoint</option>
      <option value="Word" <% If ((Request.QueryString("c") = "Word") And
(blnCatSet = False)) then Response.Write ("selected") %>>Word</option>
     </optgroup>
    </select>
                                      </td>
                                    </tr>
                                    <tr>
                                      <td width="60" height="1">?</td>
                                      <td width="200" height="1">
                                        <input type="radio" name="t"
value="header" <% If (Request.QueryString("t") = "header") Or
(Request.ServerVariables("QUERY_STRING") = "") then Response.Write
("checked") %> tabindex="" checked>
                                        Title
                                        <input type="radio" name="t"
value="Summary" <% If Request.QueryString("t") = "Summary" then
Response.Write ("checked") %> tabindex="">
                                        Summary
                                        <input type="radio" name="t"
value="Both" <% If Request.QueryString("t") = "Both" then Response.Write
("checked") %> tabindex="">
                                        Both
                                        <input type="radio" name="t"
value="pageid" <% If Request.QueryString("t") = "pageid" then Response.Write
("checked") %> tabindex="">
                                        ID??
                                        <input type="button" name="s"
value="Search" onClick="Validate();">
                                      </td>
                                      <td width="70" height="1">?</td>
                                      <td width="120" height="1">?</td>
                                    </tr>
                                  </table>

<<<<<<<< Javascript at end of HTML >>>>>>>>>

<SCRIPT LANGUAGE=VBScript RUNAT=Server>
     Function ParseForm(strFieldName)

      Set strFormData = CreateObject("Scripting.Dictionary")
      lngCount = -1
      'Try to find the Field
      lngNamePos = instr(1,strDataWhole,"name=" & chr(34) & strFieldName &
chr(34))

      'Parse through data in search of fields
       do while lngNamePos <> 0
        lngCount = lngCount + 1
        lngBeginFieldData = instr(lngNamePos,strDataWhole,vbcrlf & vbcrlf)+4
        lngEndFieldData = instr(lngBeginFieldData,strDataWhole,vbcrlf)
        strFormData.Add lngCount,
mid(strDataWhole,lngBeginFieldData,lngEndFieldData-lngBeginFieldData)
        lngNamePos = instr(lngEndFieldData,strDataWhole,"name=" & chr(34) &
strFieldName & chr(34))

       loop
       set ParseForm = strFormData
     end function
    </SCRIPT>



Sun, 19 Dec 2004 17:54:55 GMT  
 WHY, WHY, WHY!!!!!

Quote:

> Can anyone tell me what is wrong with this I have no idea why it doesnt work
> I just keep getting the same errors up again and again.

> ERROR: 'DOCUMENT.FRMSEARCH.P' IS NULL OR NOT AN OBJECT

When I fixed all the VBScript syntax errors, I didn't get any error like
this.
You don't have ASP error checking turned off do you? You were missing
more End IF statments than I could count. The page probably wasn't being
built. View the source of the document when you get this error and make
sure the form was actually rendered.

What browser are you using?

~kaeli~



Mon, 20 Dec 2004 02:56:57 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Why why why why?

2. Submit - why? why? why?

3. Why does .Execute in Command Object slower??Also why is dts faster than Ado??

4. why does document.write clears the timer?

5. ActiveInspector.CurrentItem why not work ?

6. why javascript instead of vbscript?

7. Why is IE6 recognized as Netscape 4?

8. Why doesn't this work

9. Why doesn't it work?

10. Why a postscript language?

11. Why are postscript fonts so tight?

12. Why do I need a driver?

 

 
Powered by phpBB® Forum Software