Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Display data from VBScript on a text box

Status
Not open for further replies.

rwei

Programmer
Nov 19, 2004
55
US
I use VBScript to generate some text information, which I'd like to store it on a <INPUT Type="Text"> field on a Form, so that when it displays, user gets to either accept it or change it before pressing <Submit>.

How do you do this? Thanks.
 
This is not exactly a HTML question, but let's try to work it out anyway. <input> holds its information in the attribute value, so you would insert data there:
Code:
<input type="text" value="<% Response.Write(strData) %>" />
This input box will have the value filled with whatever is in the variable strData.
 
Thanks, but what about the client-side VBScript, instead of ASP code?

 
I guess you would do it similarly to Javascript:
Code:
<script type="text/VBScript">
  document.getElementById("MyInputBox").value = "This is dynamically inserted value."
</script>

<input type="text" id="MyInputBox" />
This is untested, since I don't use client-side VBScript, because only IE supports it.
 
For some strange reason, this still doesn't work. I'll play with it a bit longer.
 
Also, can't you use JavaScript? It's support is much wider than VBScript. Unless this is a corporate intranet where users must use IE, I suggest JS.
 
This indeed is an intranet, so it's IE and VBScript. You can certainly use JS to explain or help me.

But, I am not sure this is a JS or VBS issue, it might be more to do with my understanding (or lack of) of HTML & client-side scripting. Or possibly, I didn't explain my problem right?

Basically, I have a client-side script (you can think JS), that executes in the beginning of the HTML <Body> and which generates a string. After this string is generated, I want this string to fill a <INPUT ID=abc> text box within a <Form ID=xyz>. So that users can either press <Submit> to continue, or change the string before submitting.

This sounds such a normal operation. Am I right?



 
I've had it resolved. Thank you all.

I had the script executed in the very begining of the HTML, before it can recognize the existence of the text box. Once I move the script execution after the text box, it finds it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top