473,943 Members | 14,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBScript - Cannot specify the document or form.

7 New Member
Hi

I have a page written in VBScript, which uses values from a page posted to it, to send an e-mail. The problem is that when I try to specify a control within the page I get an error, saying "Object Required : Document". Here is a piece of the code:

Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %>
  2. <%
  3. Dim szMail
  4.  
  5. szMail =    "<form id= SendAccounting  name = SendAccounting language=VBScript>"&_
  6.             "<table>"&_
  7.                 "<TR>"&_
  8.                 "<TD><STRONG><FONT size = 6; color = #ff3366;>"&"Accounting Instruction"&"</FONT></STRONG>"&_
  9.                 "</TD>"&_
  10.                 "</TR>"&_
  11.                 "<TR>"&_
  12.                 "</TR>"&_
  13.             "</table>"&_
  14.  
  15.  
  16.                 "<TABLE>" &_
  17.                     "<TR>"&_
  18.                             "<STRONG><FONT color = #ff6666;>" & "Please mark one of the following:" & "</FONT> </STRONG>" &_    
  19.                     "</TR>"&_
  20.                     "<TR>"&_
  21.                         "<TD><STRONG>"& "Matching Instruction:" & "</STRONG><INPUT id= chkMatching type= checkbox name= chkMatching>&nbsp;&nbsp;&nbsp;&nbsp;</TD>"&_ 
  22.                         "<TD><STRONG>"& "Journal:"&"</STRONG></STRONG><INPUT id= chkJournal type= checkbox name= chkJournal>&nbsp;&nbsp;&nbsp;&nbsp;</TD>"&_ 
  23.                         "<TD><STRONG>"& "Write Off:"&"</STRONG></STRONG><INPUT id= chkWriteOff type= checkbox name= chkWriteOff>&nbsp;&nbsp;&nbsp;&nbsp;</TD>"&_ 
  24.                     "</TR>"&_
  25.                     "<TR>"&_
  26.                     "</TR>"&_
  27.                     "<TR>"&_
  28.                     "</TR>"&_
  29.                 "</TABLE>"&_
  30. "</form>"
  31.  
  32. Dim TheForm
  33. Set TheForm = document.SendAccounting
  34.  
  35. if request.Form("chkMatching")= "on" then
  36. SendAccounting.chkMatching1.checked
  37. end if
  38.  
The problem occures when I try to reference the control by specifying the document and form that the controls in.

I have also tried Document.forms( o).chkmatching1 , but that doesn'y work either, I get the same error.

Any help will be appreciated.

Thanks
Feb 26 '07 #1
10 2176
dorinbogdan
839 Recognized Expert Contributor
try to give an ID to the checkbox (i.e. chkID1) and use
[HTML]document.getEle mentById("chkID 1")[/HTML] to get a reference to it.
Feb 26 '07 #2
Dino123
7 New Member
Hi

I tried that, though I'm still getting the "Object required: 'document' " error.

Thanks
Feb 26 '07 #3
dorinbogdan
839 Recognized Expert Contributor
Hmm, it seems to me that you dont have any document there, just the szMail string with the HTML code, but it is not used anywere?
Feb 26 '07 #4
Dino123
7 New Member
Yup. As you see I'm dynamically building up the table using script within the "", I've given the form the id, any ideas on the document part of it?

Would you like me to post all the code it's about 400 lines long? I only posted the offending bit.
Feb 26 '07 #5
dorinbogdan
839 Recognized Expert Contributor
Question:
Do you can access the form through
[HTML]document.getEle mentById("SendA ccounting")[/HTML]
?
Feb 26 '07 #6
Dino123
7 New Member
Hi

Tried that as well, still no luck. Getting the same error message.

Thanks
Feb 26 '07 #7
dorinbogdan
839 Recognized Expert Contributor
You should be able to access the chkMatching checkbox using
<%Request.Form( "chkMatching")% >

but I'm not sure if you can change its checked state from server on this way.
Feb 26 '07 #8
Dino123
7 New Member
Ok. I'l give it a go, though the checkbox control is on the same form.
Feb 26 '07 #9
dorinbogdan
839 Recognized Expert Contributor
If want to update some controls on client-side, try to use AJAX.
See this small tutorial.
Feb 26 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
33252
by: | last post by:
I'm trying to create a vbscript so that I can autologin and get my tasks done unattended. As part of my code, I'm trying to click to get the vbscript to click the "Login" button but I'm always getting that error mentioned below. The unusual thing about it is that the login and password fields are filled but the line of code where it's supposed to click the login button returns an error code rather than logging on to the site. Please help....
0
3482
by: Trevor Fairchild | last post by:
I'm trying to have VB6 write an html file during run-time, with some VBScript functionality. The intent is to display images based on the current record within the program - using a WebBrowser - plus some buttons to dynamically resize the image. I have gotten almost everything to work - I put in a function to simply disable the right-click option of the browser, but none of the other functions work. If I copy the source data out of...
8
5496
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
2
2605
by: ChucRock | last post by:
Hi, I have the following code where there is some client side VBScript that does something and needs to pass a variable back to the ASP.NET page. When the page is updated through a postback, the information is lost. What am I doing wrong? After obtaining the variable, I assign it back to a Label text field on the form, it shows up on the web page no problem.
2
2858
by: Frank | last post by:
Can I do this? I add a session var in C# and ultimatly want to pass it into a vbscript client side activeX control. This is what I have so far but get " Object Required:'name2' " error. Can anyone suggest a btter way of passing a session var into a vbscript function? <%@ Page language="c#" debug="true" ContentType="text/html"
2
2905
by: Beemer Biker | last post by:
I put together a few lines of vbscript so I could dump the contents of a string to my C drive. It worked fine in a small test.htm where I put the vbscript at the top of the file. It failed to work (no error message) in my large program where I needed to dump out the stuff. I did get an error message from FrontPage 2003 but it was not informative. When moved the vbscript to the bottom of the page it worked fine! ========start of...
0
1114
by: Dino123 | last post by:
Hi I have a page written in VBScript, which uses values from a page posted to it, to send an e-mail. The problem is that when I try to specify a control within the page I get an error, saying "Object Required : Document". Here is a the code: <%@ Language=VBScript %> <% Dim szMail szMail = "<form id= SendAccounting name = SendAccounting language=VBScript>"&_ "<table>"&_
2
4572
by: tunk | last post by:
I dont know where to start my question so let me tell you my story :) The ASP that cause me trouble is running on IIS that set ASP default language to JScript instead of VBScript. This ASP page is popped up by another ASP page and there are authentication, privilege and security stuff involved. And yes this page contain a lot of javascript. there is a <DIV></DIV> in this page for me. And my job is as simple as put another page between...
1
3901
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0 Days" name=revisit-after> <META content=info@siderinternational.com name=email> <META content="Omer Safdar" name=author> <META content=MegaStudios.com name=publisher> <META content="Copyright ©2005 - MegaStudios.com" name=copyright> <SCRIPT...
1
4725
by: xernoth | last post by:
Hi there, Just a quick question. I'm more familiar with C# and ASP.NET but need to use ASP/VBScript for a quick project. I have a form that uploads content to a server not managed by us. When the form is filled in and posted, the response from the server is an XML response. However when that happens, I'm not longer at my asp page, I'm redirected the XML response URL that's managed by the third party server.
0
9970
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11542
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11133
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11306
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10669
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9866
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
3517
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.