View Single Post
  #1 (permalink)  
Old October 10th, 2003, 04:15 PM
steve456 steve456 is offline
Registered User
Join Date: Oct 2003
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default How Do I Reuse data from a RecordSet?

I need help on how to reuse data stored in a recordset on a form. This is the setup:

Call the file with the form f1.asp. The form in f1.asp has a select element, a submit button, and various input:text elements. When I click the submit button, I handle the event in a JavaScript function where I set the form's action to the url of another asp page, call it f2.asp. In f2.asp, I assemble a query to select from the database, using some input from f1.asp in the where clause. I set a Session variable to this query string, and I set another Session variable to indicate what action to take when transferring back to f1.asp.

Now we are transferred back to f1.asp, and the Session variable set in f2.asp is checked and the value of it indicates we want to populate the select element. The other Session variable with the query is used by a recordset and the query is executed. Next loop through the recordset and populate the select element, and also save off the same data (and some additional data) in an array so that I have the data saved and can close the recordset.

Now we have a populated select element. The idea now is to click on an item in the select element, then display other data that is associated with the selected item, i.e. I click on item "Tim Jones" in the select element, and populate the input:text elements on the form with other data for "Tim Jones". Assume this is the data that was saved in the array I discussed earlier.

The dilemma is, the recordset code, and the code where I initialize the array was all in <% %> tags. When I handle the onclick event for the select element (this is dynamic html – not asp related), I don’t seem to be able to use asp tags, in other words, I can't seem to have access to the array with the data I need to populate the input:text elements.

Does anyone have experience doing this kind of thing?

Reply With Quote