Roy, you emphasize "dynamic" enough that I have to ask:  are you hoping
to dynamically retrieve data across the network at the moment of a page
event (menu selection) and display it in text boxes without refreshing
the rest of your page?  That's not possible in ASP (it is possible in
ASP.NET.)

If it will suffice to have all your data written into Javascript code
structures that are passed down to the client during page creation, then
you can do that with either VBScript or Javascript.  While some clever
people can use server-side java to read a database and create Javascript
data structures from the data, I'm not one of them.  Quite a few free
web sites offer javascript code and advice including these ones:

http://www.js-examples.com/js/
http://webdeveloper.earthweb.com/webjs
http://webreference.com/js/

For VBScript I can offer some advice.  Look at the bottom of the
document below for an example of how to load a  recordset from a
database with VBScript and ADO.  The document also includes other
examples you as an ASP virgin may find useful.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvid/h
tml/msdn_viscript.asp

There are other documents on the MSDN web site which will also be useful
in helping you learn to use ADO (ActiveX Data Objects) to retrieve
information from a database.

Once you have a recordset you can cycle through it using the Movenext
method, or you can use the recordset's GetRows method to load the data
into an array - very slick, very fast, look it up.

As you cycle through the recordset or array, you use the Response.Write
statement to write out the actual javascript code that you want to have
sent down in the page you're creating.  For example this code:

<script language=javascript>
var arrCityNames = new Array(5) 
<%
' use VBScript to write array elements
' arrData is VBScript array from database created with GetRows
For i = 0 to 4 ' GetRows array is zero-based
  Response.Write "arrCityNames[" & i + 1 & "] = "
  Response.Write chr(34) & arrData(i,0) & chr(34) & vbCrLf
Next
%>
</script>

would produce something like the following in the page that gets sent to
the client.

<script language=javascript>
var arrCityNames = new Array(5) 
arrCityNames[1] = "New York"
arrCityNames[2] = "Toronto"
arrCityNames[3] = "Paris"
arrCityNames[4] = "Rome"
arrCityNames[5] = "Washington"
</script>

You can take it from here, right?

HTH

-----Original Message-----
From: Roy Murdock [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, August 21, 2002 4:25 PM
To: ActiveServerPages
Subject: dependant text fields



The JS approach breaks down b/c the data needs to be dynamic. I think
dynamic arrays are the way to go (as you suggest in your third
paragraph) but I'm having trouble with them. Can I use JS to do this or
does it require VB? How can I make those arrays dynamic?


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to