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
}
LVL 1
dba123Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

j2nkuCommented:
Instead

var f = document.requestspace;

try

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

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

FtB
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fritz_the_blankCommented:
Next, when you run your page, does the textarea named purpose appear?

ftB
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.