Dynamically Fill List Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • buntyindia
    New Member
    • Jun 2007
    • 101

    Dynamically Fill List Box

    Hi,

    I have three Listbox on my jsp page.

    I want to do following:

    ByDefault first list will be filled by database, When User select something from 1st list box second will fill accordingly by database using Ajax.

    When user select something from 2nd list third will get data.


    Please help in this how to do this.....I don't want to refresh whole page


    Regards,
  • tromton
    New Member
    • Dec 2007
    • 8

    #2

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Originally posted by buntyindia
      I have three Listbox on my jsp page.

      I want to do following:

      ByDefault first list will be filled by database, When User select something from 1st list box second will fill accordingly by database using Ajax.

      When user select something from 2nd list third will get data.
      What code have you got so far? Get your server-side script to return the options, parse the response to append them to the second list, or just return some HTML and set the innerHTML.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by tromton
        That's a non-Ajax solution, but an alternative nonetheless.

        Comment

        • buntyindia
          New Member
          • Jun 2007
          • 101

          #5
          Originally posted by acoder
          That's a non-Ajax solution, but an alternative nonetheless.
          Hi Mod,

          Thanks for the reply :)

          I have created the ajax solution...now one more problem i am facing....in IE
          in Mozilla everything working Fine.

          First List I am generating by default on the page load time by the database...
          To fill the second list I am Storing the Selected Item of first list inside a variable then I am creating a URL (example: /Query.jsp?selec tedOption="Some thing")
          and passing this using ajax to controller to fetch the data from database.

          Till stage it is working fine in both browsers...
          But when I select something in Second List to generate the third list in URL the value for selectedOption i am getting blank in IE(example: /Query.jsp?selec tedOption=) in Mozilla i am getting the value correctly...


          Why it is not getting the value inside IE...please help....
          In view source code i notable to see the code of lists boxex that are generated on the fly using the Javascript...


          Please help

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Originally posted by buntyindia
            But when I select something in Second List to generate the third list in URL the value for selectedOption i am getting blank in IE(example: /Query.jsp?selec tedOption=) in Mozilla i am getting the value correctly...
            Can you show the code for this part?

            Comment

            Working...