• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 238
  • Last Modified:

JavaScript / ASP: is null or not an object error

Error: 'f.purpose" is null or not an object

Not sure why I am getting the error but here is my code:


Response.Write("                    <table width=""100%"" border=""0"" bordercolor=""red""  cellspacing=""0"" cellpadding=""0"" name=""Data"">" & vbCrLf)
Response.Write("                             <tr>" & vbCrLf)
Response.Write("                                   <td align=""center"" valign=""top"" class=""owner"" colspan=""2""><b>Request Usage</b></td>" & vbCrLf)
Response.Write("                      </tr>" & vbCrLf)
Response.Write("                          <tr>" & vbCrLf)
Response.Write("                              <td valign=""top"" align=""left"">" & vbCrLf)
Response.Write("                                    <form action=""/sss/main.asp?action=requested"" method=""post"" name=""requestspace"" OnSubmit=""return CheckNewRequest();"">" & vbCrLf)
Response.Write("                                     <input type=""hidden"" name=""requested"" value=""1"">" & vbCrLf)

Response.Write("                            There is a total of <b>" & GetRemainingDiskSpace(Session("ResourceID")) & "gb </b><br> available for <b>" & Query("ResourceName") & "</b>.<br><br>Select a disk space amount:<br><br>" & vbCrLf)
Response.Write("                                          <select name=""disksize"" size=""1""><option value="""">" & vbCrLf)
Response.Write("                                          -- Gigabytes --</option>" & vbCrLf)
                                                                  strSQL = "sp_Get_DiskSpaceList_Request @ResourceID=" & Session("ResourceID")
                                                                  Set Query1 = objConnection.Execute(strSQL)

                                                                  If NOT Query1.EOF Then
                                                                        Do While NOT Query1.EOF
Response.Write("                                                        <option value=" & Query1("DiskSizeID") & ">" & Query1("DiskSize") & "</option>" & vbCrLf)
                                                                              Query1.MoveNext
                                                                        Loop
                                                                        Else
Response.Write("                                                <option value="""">No options found</option>" & vbCrLf)
                                                                  End If

                                                                  Set Query1=Nothing


Response.Write("                                    </select><br><br>" & vbCrLf)
Response.Write("                              </td>" & vbCrLf)
Response.Write("                          </tr>" & vbCrLf)

Response.Write("                          <tr>" & vbCrLf)
Response.Write("                              <td valign=""top"" align=""left"">I am using this PC for:<br><br>" & vbCrLf)
Response.Write("                                          <select name=""purposetype"" size=""1""><option value="""">" & vbCrLf)
Response.Write("                                          -- Purpose Type --</option>" & vbCrLf)
                                                                  strSQL = "sp_Get_RequestPurpose"

                                                                  Set Query1 = objConnection.Execute(strSQL)

                                                                  If NOT Query1.EOF Then
                                                                        Do While NOT Query1.EOF
Response.Write("                                                  <option value=""" & Query1("RequestPurposeId") & """")
                                                                              Response.Write (">" & Query1("Purpose") & "</option>" & vbCrLf)
                                                                              Query1.MoveNext
                                                                        Loop
                                                                        Else
Response.Write("                                                <option value="""">No Types found</option>" & vbCrLf)
                                                                  End If

                                                                  Set Query1=Nothing

Response.Write("                                    </select><br><br>" & vbCrLf)

Response.Write("                              </td>" & vbCrLf)
Response.Write("                          </tr>" & vbCrLf)

Response.Write("                           <tr>" & vbCrLf)
Response.Write("                                <td align=""left"">" & vbCrLf)
Response.Write("                                          <table>" & vbCrLf)
Response.Write("                                                <tr>" & vbCrLf)
Response.Write("                                                      <td align=""left"" valign=""middle""><a href=""/sss/sss.asp?item=subject"" onClick=""popup('/sss/sss.asp?item=subject'); return false;"">Purpose</a>:</td>" & vbCrLf)
Response.Write("                                                      <td align=""left""><textarea cols=""19"" rows=""2"" name=""purpose"" wrap=""physical""></textarea></td>" & vbCrLf)
Response.Write("                                                </tr>" & vbCrLf)
Response.Write("                                                <tr>" & vbCrLf)
Response.Write("                                                      <td align=""left"" valign=""middle""><a href=""/sss/sss.asp?item=subject"" onClick=""popup('/sss/sss.asp?item=subject'); return false;"">Start Date</a>:</td>" & vbCrLf)
Response.Write("                                                      <td align=""left""><input type=""text""  name=""startdate"" size=""13"" maxlength=""10""></td>" & vbCrLf)
Response.Write("                                                </tr>" & vbCrLf)
Response.Write("                                              <tr>" & vbCrLf)
Response.Write("                                                      <td align=""left"" valign=""middle""><a href=""/sss/sss.asp?item=subject"" onClick=""popup('/sss/sss.asp?item=subject'); return false;"">End Date</a>:</td>" & vbCrLf)

Response.Write("                                                      <td align=""left""><input type=""text""  name=""enddate"" size=""13"" maxlength=""10"">" & vbCrLf)
Response.Write("                                                      <br>Indefinitely<input type=""checkbox"" class=""checkboxwhite"" name=""indefinite"" value=""ON""></td>" & vbCrLf)
Response.Write("                                                </tr>" & vbCrLf)
Response.Write("                                          </table>" & vbCrLf)
Response.Write("                           </tr>" & vbCrLf)
Response.Write("                          <tr>" & vbCrLf)

Response.Write("                                      <td><br><input type=""submit"" name=""requestmain"" value=""Request Now!"" class=""submitbutton""> &nbsp;<input type=""button"" name=""cancel"" value=""Cancel"" class=""submit_cancel"" OnClick=""window.open('/sss/main.asp?status=rc', '_self')""><br><br></td>" & vbCrLf)
Response.Write("                                    </form>" & vbCrLf)
Response.Write("                          </tr>" & vbCrLf)
Response.Write("                    </table>" & vbCrLf)

%>


<script type="text/javascript">
<!--

var f = document.requestspace;

function CheckNewRequest() {

      if (f.purpose.value.length < 5) {
            alert("Please enter a valid Purpose");
            f.purpose.focus();
            return false;
      } else if (f.startdate.value.length < 8) {
            alert("Please enter a valid Start Date");
            f.startdate.focus();
            return false;
      } else if (!IsDate(f.startdate.value)) {
            alert("Please enter a valid date for Start Date.");
            f.startdate.focus();
            return false;
      } else if (f.enddate.value.length < 8) {
            alert("Please enter a valid End Date");
            f.startdate.focus();
            return false;
      } else if (!IsDate(f.enddate.value)) {
            alert("Please enter a valid date for End Date.");
            f.end.focus();
            return false;
      } else if (f.purposetype.options[f.purposetype.selectedIndex].value.length < 1) {
            alert("Please select a Purpose Type");
            f.purposetype.focus();
            return false;
      } else if (f.disksize.options[f.disksize.selectedIndex].value.length < 1) {
            alert("Please select the Disk Size you are requesting to use");
            f.os.focus();
            return false;
      }

      // Prevent multiple form submissions
      f.Submit.value = "Resource Submitted, Please Wait...";
      f.Submit.disabled = true;
      return true;

}
Deleted by ee_ai_construct, 500 points refunded. - 11/21/2004 9:56:10 PM PST
}
{
Question reopened, points reinstated - ee_ai_construct - 11/22/2004 4:47:10 PM PST
}
0
dba123
Asked:
dba123
  • 8
  • 2
1 Solution
 
j2nkuCommented:
Instead

var f = document.requestspace;

try

var f = eval("document.requestspace");

J.
0
 
fritz_the_blankCommented:
var f = document.forms['requestspace'];

FtB
0
 
fritz_the_blankCommented:
Next, when you run your page, does the textarea named purpose appear?

ftB
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
fritz_the_blankCommented:
Finally, if you can run the page, view the source, and then paste the result here like you did last time, I should be able to sort this out quickly.

ftB
0
 
fritz_the_blankCommented:
So, is this question a dead issue?

FtB
0
 
dba123Author Commented:
Have not had a chance to get back to it, but will soon.
0
 
dba123Author Commented:
this is a dead issue at this point
0
 
fritz_the_blankCommented:
We could all save a lot of time if db123 would immediately post to the thread saying that s/he found his/her answer or wanted the question deleted staright away. That way, we wouldn't have to waste time reading his/her questions and then posting to threads. I can't quite count how many times this has happened. What's the old saying, fool me once, shame on you, fool me twice, shame on me?

;->

0
 
fritz_the_blankCommented:

All kidding aside, dba123 has somewhere between a third and a quarter of all questions deleted. Perhaps a little more thougth before posting is in order?

FtB
0
 
fritz_the_blankCommented:
I suspect that my answer in http:#12545843 should do it. If not, once I see the result of running the code and viewing the source, we should be able to verify that is the case.

FtB
0
 
fritz_the_blankCommented:
Fair enough. If dba123 wants to resolve the issue, I need feedback in order to continue the thread. Otherwise, I suggest that s/he select the comment that helped him/her the most as an answer.

FtB
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 8
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now