Results 1 to 3 of 3

Thread: Object Required Error? - **** Resolved ****

  1. #1

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772

    Object Required Error? - **** Resolved ****

    Hello,

    I'm trying to submit a form without using a button, I'm getting an object required error when referencing window and document? Does anyone know why? I thought they were built in objects?

    these are the three errors I've been getting -
    Object required: 'window'
    Object required: 'document'
    Object required: ''


    Code:
    <%@ Language=VBScript %>
    <% 
    Dim UID
    Dim PWD
    
    If Len(Request.Form("txtUID")) Then 
    	ProcessPWD()
    End If
    
    Function ProcessPwd()
    Dim rtnCode
    Dim theFrm 
    
    Set theFrm = window.document.form1
    'Set theFrm = document.form1
    
    
    UID = Request.Form("txtUID")
    PWD = Request.Form("txtPwd")
    
    If (UID = "calvin") And (PWD = "hobbes") Then
    	rtnCode = 1
    Else
    	rtnCode = 0
    End If
    
    	Select Case rtnCode
    		Case 1 ' Login OK
    			theFrm.Submit
    		
    		Case Else ' Login Fail
    			Response.Write("<p>Login Attempt failed please try again" & vbcrlf)
    			Response.Write("</p>" & vbcrlf)
    	End Select
    
    End Function
    %>
    <html>
    <head>
    <meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </head>
    <body>
    <p>&nbsp;</p>
    <!-- The Auto Submit form -->
    <form name="form1" id="form1" action="../autoSubmit/changed.htm" method="post">
    	<input type="hidden" name="txtUID" id="txtUID" value="<%=UID%>">
    	<input type="hidden" name="txtPwd" id="txtPwd" value="<%=Pwd%>">
    </form>
    </body>
    </html>
    Any help will be appreciated!!
    Last edited by aconybeare; Jun 16th, 2003 at 09:31 AM.

  2. #2
    Hyperactive Member Anglo Saxon's Avatar
    Join Date
    Mar 2002
    Location
    Durham, UK
    Posts
    259
    You cannot use ASP in this way, ASP is server side only which means you have no access to the client browser(apart from limited information which it passes to the server whn requesting a page). The only way ASP can interact with the client browser is when the user allows it to by sending information to the server. Once you process that information and send it back to the browser you cannot do anything else with it.

    --
    Anglo Saxon

  3. #3

    Thread Starter
    Fanatic Member aconybeare's Avatar
    Join Date
    Oct 2001
    Location
    UK
    Posts
    772
    Anglo,

    Thanks for that, I'll change it to use javascript on the client.

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width