7 Replies Latest reply on Apr 4, 2007 6:38 AM by emmim44

    Not ajax Q

    emmim44 Level 1
      Good morning all.
      I have a dropdown select box populated with departments name. So when one select one of the department, the system should query the employees info in the oracle db based on the selected department, and then should display on a div ....Any help will be appreaciated...Thanks.
        • 1. Re: Not ajax Q
          insuractive Level 3
          Hey Emmim, not sure exactly what you are asking in your question. It seems like you are asking a question about how to use AJAX to query a database and return employee data for a selected department to your page. However, your topic title is "Not Ajax", so I'm a little confused. It seems like there are 2 possible solutions to your question:

          1) Ajax solution - have a javascript function that is called when your select box value changes that performs an AJAX call (ie. passes a department ID to another CF page, which queries your DB, and returns the employee data in XML (or even HTML)), and then puts that data in a <div> tag

          2) Non-Ajax Solution - submit the form when a department is selected, and perform the look up and page formatted in CF on the form's action page.
          • 2. Re: Not ajax Q
            emmim44 Level 1
            In your 2nd solution, should i use a div with it...
            • 3. Re: Not ajax Q
              insuractive Level 3
              In the second solution I listed, you could use whatever formatting you wanted to display the employee information (a table, grid, spreadsheet):

              1) User selects department from drop down in form
              2) Form is submitted to action Page via regular HTTP post
              3) on action Page: query DB, return employees, format employee info in HTML
              • 4. Re: Not ajax Q
                emmim44 Level 1
                opps.my bad..I want to see the employee info on the same page...after selecting a dept..
                • 5. Re: Not ajax Q
                  Level 7
                  then javascript or ajax are your options.

                  with js you can pre-buid a 2d array of employees for each department,
                  and then change the content of your div based on which department was
                  selected in the listbox.

                  ajax will do nicely, too.

                  Azadi Saryev
                  • 6. Re: Not ajax Q
                    Level 7
                    You can set your first drop down as a jump menu and have it do a post back
                    to the same page and page and use a IsDefined to have the second dropdown
                    pull the information. I do that on a couple of my sites since I can't seem
                    to get the Ajax working. Its ugly but it works perfect for the time being.

                    • 7. Re: Not ajax Q
                      emmim44 Level 1
                      Sounds good guys...thanks..