Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2012, 02:09 AM
Registered User
 
Join Date: Jul 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading a form element

I have several html forms in a page. I want to define a variable equal to a form element value. The following code results in ' Object required: " ' error. I've researched and can't find syntax examples anywhere, so I don't know if it's a syntax problem or I'm going about this the wrong way altogether.

<&
Dim passed
passed = Document.Forms(2).Elements(4).value
...
&>
 
Old July 29th, 2012, 06:31 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

no you cant do this at all, you need to think like this:

document.theFormName.theFieldName.value

you can pass theFormName and theFieldName when you call JS function and yes you do use the equivalent of ....Element[4] but only inside JS loops. Im not really sure what else to say
__________________
Wind is your friend
Matt
 
Old July 30th, 2012, 05:11 PM
Registered User
 
Join Date: Jul 2012
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I named the form and element and tried it like that, but I must have still had the syntax wrong. Anyway, I appreciate your input. I managed to do it another way. The form value is also posted to the server, and I figured out how to get it from there.





Similar Threads
Thread Thread Starter Forum Replies Last Post
positioning text + form element + firefox Adam H-W CSS Cascading Style Sheets 2 June 12th, 2007 03:18 AM
Getting form element names in a loop crapanz Javascript 5 January 30th, 2006 12:45 AM
Reading every element from the specified node ROCXY XSLT 1 January 3rd, 2006 09:25 AM
file form element nerssi Javascript 3 January 18th, 2005 06:14 AM
Form element "memory" - for checkboxes SoC VBScript 1 September 1st, 2004 04:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.