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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing Server Data in Client Script

Status
Not open for further replies.

DaiK

Programmer
Dec 3, 2003
2
AU
Hi, I'm somewhat new to scripting and web development. The closest thing I could find to my question was the question from JanS on 7/24 about populating a listbox with selected elements from a recordset in client script depending on a users radio button selections.

Is there a way that I can "pass down" a recordset that was created in server script so that I can access the data from a client-side script? Basically I want to populate the default values of a form (with data from the recordset) according to a listbox selection (in a list that has already been populated in server script).
Code:
Listbox1:               Form:
---------               ----------------------------
Person1ID               Name Textbox: Person2's Name
Person2ID (Selected)    Other Fields: Person2's Info
Person3ID
                        SubmitButton
Hope you can see what I'm trying to do. Any help, pointers, etc. is greatly appreciated. Trying to do it the "right" way, but in lieu of that I'd be grateful for any method that would work. :)

Thanks,

Daik
 
U have to use Remote Scripting Objects to do that without resumitting the information of the listbox to the server... but i cant help u wit that...
If u want tu use by resubmitting the inf to server tell me and i'll help u... ________

George
 
Thanks, but no, I was looking for a way to do it without resubmitting the form. As I've said, I'm new at this, and dunno if I'm gonna end up regretting doing it this way, but I think I'm going to stuff the entire record into the "VALUE" property of the list element. Then I'll parse it out to get my field values when the user clicks on the listbox.

Thanks,

Daik
 
You don't have to use remote scripting, you can use the Remote Data Service(?), anyway, there is this object you can embed that will allow you to access your server to pull down a recordset. Just put this:

<OBJECT CLASSID=&quot;CLSID:BD96C556-65A3-11D0-983A-00C04FC29E36&quot; ID=&quot;ADS&quot; WIDTH=&quot;1&quot; HEIGHT=&quot;1&quot;></OBJECT>

on your page and call this:

ADS.Query Connection_String, SQL

from your code, where Connection_String is the same thing you use on your server-side to open the ADO connection and SQL is your select statement. I hope this works for you! &quot;A computer scientist is a person who knows when it is time to hit the computer.&quot;

John

johnmc@mvmills.com
 
And if u use Netscape how does it works?
________

George
 
If you want it to work with JavaScript, you will have to use Remote Scripting. If you use InterDev, you can find it in your _ScriptLibrary folder, rs.htm and rs.asp. &quot;A computer scientist is a person who knows when it is time to hit the computer.&quot;

John

johnmc@mvmills.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top