ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 3rd, 2011, 01:46 PM
ecit12's Avatar
ecit12 ecit12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 418 ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 13 h 53 m 25 sec
Reputation Power: 11
VB Script: Text Object Value

I'm not sure if this is possible but this is what I'm trying to accomplish.

I have a dynamic number of HTML text boxes that I generate, and i is the iteration number.
vb Code:
Original - vb Code
  1. <input type=""text"" name=""IntfNm"&i & """ size=""20"">


next I'm trying to extract the value of the text field and write it to a file. This is where I'm having an issue.

vb Code:
Original - vb Code
  1. intfNmVar ="IntfNm"&i
  2. objTextFile.Write(intfNmVar.Value)


It doesn't like the last line. I'm extracting the value of the text field instead of the HTML text object.

Any suggestions?

Reply With Quote
  #2  
Old May 7th, 2011, 11:30 PM
ecit12's Avatar
ecit12 ecit12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 418 ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 13 h 53 m 25 sec
Reputation Power: 11
Solution

So here is the solution to the problem.

Instead of name, I use ID
vb Code:
Original - vb Code
  1. <input type=""text"" id=""IntfNm"&i & """ size=""20"">


and to retrieve the value I use the following code.
vb Code:
Original - vb Code
  1. intfNmVar ="IntfNm"&i
  2. objTextFile.Write(document.getElementById(intfNmVar).Value)

Reply With Quote
  #3  
Old May 7th, 2011, 11:50 PM
ecit12's Avatar
ecit12 ecit12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 418 ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level)ecit12 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 2 Days 13 h 53 m 25 sec
Reputation Power: 11
Solution

to make this work you need to use the ID instead of NAME in the input element.

VB Code:
Original - VB Code
  1. <input type=""text"" id=""IntfNm"&i & """ size=""20"">


Then use the method getElementByID

VB Code:
Original - VB Code
  1. intfNmVar="IntfNm"&i
  2. objTextFile.Write(document.getElementById(intfNmVar).Value)

Reply With Quote
  #4  
Old May 8th, 2011, 05:50 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,239 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 17 m
Reputation Power: 4445
Thanks for posting your findings.
__________________
======
Doug G
======
It is a truism of American politics that no man who can win an election deserves to. --Trevanian, from the novel Shibumi

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > VB Script: Text Object Value

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap