469,267 Members | 971 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

ASP object required error - vbscript

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


Jul 19 '05 #1
3 7821
> <%
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.)
Jul 19 '05 #2
On Mon, 9 Aug 2004 10:04:00 -0700, "News Groups"
<eh*******@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
Jul 19 '05 #3
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" <eh*******@verizon.net> wrote in message
news:%2***************@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

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Apostolis K. | last post: by
6 posts views Thread by Steve Richter | last post: by
reply views Thread by Jennifer.Berube | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.