SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast scarlettaurus's Avatar
    Join Date
    Dec 2004
    Location
    India
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry list box to list box to listbox.....phew....

    /* Incoming data is in the form
    <dataSet>
    <data>
    <name></name>
    <dataRow></dataRow>
    <desc>this part is the description</desc>
    </data>
    </dataSet>
    */
    function convertXML () {
    listbox1.removeAll();
    mainTag = new XML();
    elementTag = new XML();
    dataList = new Array();
    elementList = new Array();
    mainTag = this.firstChild;
    if (dataXML.loaded) {
    if (mainTag.nodeName == "dataSet") {
    dataList = mainTag.childNodes;
    for (i=0; i<=dataList.length; i++) {
    if (dataList[i].nodeName == "data") {
    elementList = dataList[i].childNodes;
    for (j=0; j<=elementList.length; j++) {
    elementTag = elementList[j];
    elementType = elementTag.nodeName;
    if (elementType == "name") {
    Name = elementTag.firstChild.nodeValue;
    }
    if (elementType == "dataRow") {
    Info = elementTag.firstChild.nodeValue;
    }
    if (elementType == "desc") {
    Desc = elementTag.firstChild.nodeValue;
    }
    }
    // Adds the label and data to the URL.
    var comboData = { info:Info, descesc};
    listBox1.addItem(Name, comboData);
    }
    }
    }
    }
    // Sets the change handler for the Component named 'dropDown'.
    listbox1.setChangeHandler("SelectItem");
    }

    // This is the Change handler it tells the the movie what to do when someone clicks on an item.
    function SelectItem(){
    // Gets rid of Current items
    listBox.removeAll();

    // Split array's and assign to ListBox.
    Info = listbox1.getSelectedItem().data["info"];
    DescN = listbox1.getSelectedItem().data["desc"];
    InfoArray = Info.split(",",6);
    DescArray = DescN.split(",",6);

    numLoop = InfoArray.length;

    for(i=0; i<numLoop; i++) {
    var listData = { infoescArray[i]};
    listBox.addItem(InfoArray[i], listData);
    }
    // Set Change Handler for List Box.
    listBox.setChangeHandler("SelectItemList");
    }
    // Change handler for the ListBox..
    function SelectItemList(){
    itemInfo = listBox.getSelectedItem().data["info"];
    }



    this code basically loads a listbox from the results returned from a php page querying an access database in an xml format. When an item in listbox1 is clicked it displays some of the other feilds in listbox (listbox no.2). what i want to do is to query another table and return the results correspoding to the item clikec in the previous list box.....pls help me ...im not quite sure how to query one table from the item clicked on the list box...psl add ur suggestions and codes here ....or samples too...

    in this code i have given the change handler for the second listbox to display a field in the text box...but the requirement is to load a swish movie into a window ...i need help in that one too....

    thanks a lot in advance...n thanks sitepoint for such a great forum....
    c ya guys ...

  2. #2

    Join Date
    Oct 2003
    Location
    €uroLand
    Posts
    1,340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess thats JavaScript and this goes into http://www.sitepoint.com/forums/forumdisplay.php?f=15


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •