SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict rokc's Avatar
    Join Date
    Oct 2004
    Posts
    280
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Popuplating Dropdown List From Database

    hi,

    I have a two dropdown lists (Job Catogory and Sub Job Catagory). The values are populated from the database in the following manner, when a user chooses a particular job catagory from the Job Catagory list, the corrosponding sub job catagories are populated into the Sub Job Catagory list. I am using asp as the server side script and sql server as the database. Now whats happening is that when a user chooses a particular job catagory, the form reloads and thn only the sub job catagory list is populated.Is there any way that this thing can be done without reloading the page.Someone told me it can be done through XML.

    Can anybody help me out as I really dont know XML..

    rgds,

    rokc

  2. #2
    SitePoint Member livewire10's Avatar
    Join Date
    Dec 2004
    Location
    CA
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think that approach is too slow, imagine having the trip back to the server everytime a new category is clicked to pull its corresponding sub-categories. You wont gain any significant improvement even if you use XML. If we're talking of less than 20 categories and maximum of 20 subcategories for each category, I would suggest that you load all that data in one trip to the server and do the dynamic display using pure Javascript - all happening in the client side.

  3. #3
    SitePoint Wizard swdev's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ceretainly, using JavaSCript would be kinder to the webserver (less trips to the server) but what happens when the user has JavaScript turned off. The whole form breaks !!!
    Personaly, I would always go back to the server to get the new information. It will be slower than the JavaScript solution, but at least you know your form won't be broken by a user surfing with JavaScript turned off.

    Just remembeer - there are soe threads within SitePoint 9and an Article I think) using xmlhttprequest Try searching for these. Might give you some ideas as using this technique (which I have not) does not require a complete page reload.
    Last edited by swdev; Jan 9, 2005 at 08:04. Reason: Added xmlhttprequest Information


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
  •