IIS ASP - ASP object required error - vbscript

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > August 2004 > ASP object required error - vbscript





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author ASP object required error - vbscript
News Groups

2004-08-09, 5:54 pm

Dear Group
I am trying to use the following code to refer to a form and control on my
form. I am supposed to be using VBSCRIPT for this code.
I always get an "object required: 'document' " error:

<%
Dim Myform
Set Myform = document.forms.thisform
Myform.textbox1.value = "fish" %>

None of this code will work. Always get an error.
Using Visual Interdev, plain ole ASP, and vbscript, and Win XP Pro with IIS
5.1

What am I missing or doing wrong???

Thanks

eric




Aaron [SQL Server MVP]

2004-08-09, 5:54 pm

> <%
> Dim Myform
> Set Myform = document.forms.thisform


You are seriously confusing client-side and server-side concepts. ASP
executes as, basically, a two-step process. ASP runs on the server, and so
has no knowledge of client-side things like forms. Once ASP finishes
running, the client-side code runs and, likewise, it has no knowledge of
server-side subs, functions, etc. Think about getting a passport, you need
to get your photo first, then apply for the passport. Does it make sense to
have your passport # printed on the photo before your passport # has been
issued?

You can make the two communicate in different ways, but what you're doing
isn't one of them.

To replicate what you're trying to do:

<%
myValue = "fish"
%>
<input type=text name=textbox1 value='<%=myValue%>'>

Not sure why you are "supposed to be using VBScript" ... you should use
JavaScript on the client so that your pages will work in Firebird/Firefox,
Mozilla, etc.

--
http://www.aspfaq.com/
(Reverse address to reply.)


Jeff Cochran

2004-08-09, 5:54 pm

On Mon, 9 Aug 2004 10:04:00 -0700, "News Groups"
<eholz.one@verizon.net> wrote:

>Dear Group
>I am trying to use the following code to refer to a form and control on my
>form. I am supposed to be using VBSCRIPT for this code.
>I always get an "object required: 'document' " error:
>
><%
>Dim Myform
>Set Myform = document.forms.thisform
>Myform.textbox1.value = "fish" %>
>
>None of this code will work. Always get an error.
>Using Visual Interdev, plain ole ASP, and vbscript, and Win XP Pro with IIS
>5.1
>
>What am I missing or doing wrong???


Mixing VBScript and Javascript with something I can't identify...

You haven't created a Myform object is what's likely causing the
error, but I have no idea why you would want to. What exactly are you
trying to accomplish?

Jeff
Mark Schupp

2004-08-09, 5:54 pm

Document is a client-side object supplied by the browser to the local
scripting environment. You are trying to use it in server side code.

--
Mark Schupp
Head of Development
Integrity eLearning
www.ielearning.com


"News Groups" <eholz.one@verizon.net> wrote in message
news:%239HWRKjfEHA.236@tk2msftngp13.phx.gbl...
> Dear Group
> I am trying to use the following code to refer to a form and control on my
> form. I am supposed to be using VBSCRIPT for this code.
> I always get an "object required: 'document' " error:
>
> <%
> Dim Myform
> Set Myform = document.forms.thisform
> Myform.textbox1.value = "fish" %>
>
> None of this code will work. Always get an error.
> Using Visual Interdev, plain ole ASP, and vbscript, and Win XP Pro with

IIS
> 5.1
>
> What am I missing or doing wrong???
>
> Thanks
>
> eric
>
>
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com