Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 9th, 2005, 09:24 PM
Authorized User
 
Join Date: Aug 2005
Location: San Diego, California, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP/MySql database into JavaScript Array

what i am trying to do is create a Dynamically linked pair of ComboBoxes. State/City to be exact. you click on the state ComboBoxand select say california and you get say San Diego in the City ComboBox. i have everything worked out except how to set up my asp database connection to work with this javascript code.

function populatecombo(elem, index, array){
    if (array.length >= index){
        if (array[index]){
            for (var i = 0; i < array[index].length; i= i + 2){
                elem.options[elem.options.length] = new Option(array[index][i + 1], array[index][i]);
            }
        }
        else{
            elem.options[elem.options.length] = new Option("[none available]", 0);
        }
    }
    else{
        elem.options[elem.options.length] = new Option("[none available]", 0);
    }
}

i already have a function that clears the combo box of its selections and my database is set up so that it has one table with the ID, StateID, StateName and CityName.
the sql statement selects all info from the table and fills the state ComboBox using seperate asp code. then i have the state ComboBox onChange event handler call the script to clear the city box, then repopulate the city box using the "populatecombo" script. nothing happens so far because i dont know how to transfer information from either a recordset table or an array in asp into javascript. the only thing i have been able to come up with would be to use an asp loop to write the javascript. i am trying to avoid this since i know very little javascript.

any help would be appreciated

-----------------------------------------
Inigo: You have a great gift for rhyme.
Fezzik: Yes, yes, some of the time.
Vizzini: Enough of that.
Inigo: Fezzik, are there rocks ahead?
Fezzik: If there are, we'll all be dead.
Vizzini: No more rhymes now, I mean it!
Fezzik: Anybody want a peanut?
__________________
-----------------------------------------
Inigo:&nbsp;&nbsp;&nbsp;You have a great gift for rhyme.
Fezzik:&nbsp;&nbsp;Yes, yes, some of the time.
Vizzini: Enough of that.
Inigo:&nbsp;&nbsp;&nbsp;Fezzik, are there rocks ahead?
Fezzik:&nbsp;&nbsp;If there are, we\'ll all be dead.
Vizzini: No more rhymes now, I mean it!
Fezzik:&nbsp;&nbsp;Anybody want a peanut?
 
Old August 14th, 2005, 10:02 PM
Authorized User
 
Join Date: Aug 2005
Location: San Diego, California, USA.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

anybody have any ideas about this?

-----------------------------------------
Inigo: You have a great gift for rhyme.
Fezzik: Yes, yes, some of the time.
Vizzini: Enough of that.
Inigo: Fezzik, are there rocks ahead?
Fezzik: If there are, we'll all be dead.
Vizzini: No more rhymes now, I mean it!
Fezzik: Anybody want a peanut?




Similar Threads
Thread Thread Starter Forum Replies Last Post
Transfer double array from asp to javascript simi Classic ASP Databases 1 May 17th, 2005 06:40 AM
Reference ASP Array in Javascript gaetano Classic ASP Basics 1 February 21st, 2005 10:09 AM
Passing php array values to javascript array gkrishna Pro PHP 0 November 6th, 2004 03:20 AM
MySql Database with ASP RobinR Classic ASP Databases 0 February 23rd, 2004 09:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.