Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ListBox value

ListBox value

Scheduled Pinned Locked Moved Web Development
javascriptdatabase
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ekendricks
    wrote on last edited by
    #1

    I have a listbox "Employee" that is pouplated with a SQL stmt. In the SQL stmt, I can SELECT ID, Name, Dept, Etc. The listbox shows the "ID - 25" and "Value -Name". I do not need to see any additional information in the listbox, but I need a javascript function to populate a textbox "Dept" with the "Dept value" that was retreived with the SQL stmt. Ernest

    C 1 Reply Last reply
    0
    • E ekendricks

      I have a listbox "Employee" that is pouplated with a SQL stmt. In the SQL stmt, I can SELECT ID, Name, Dept, Etc. The listbox shows the "ID - 25" and "Value -Name". I do not need to see any additional information in the listbox, but I need a javascript function to populate a textbox "Dept" with the "Dept value" that was retreived with the SQL stmt. Ernest

      C Offline
      C Offline
      cdengler
      wrote on last edited by
      #2

      More information required here.. Are you saying that you already have the listbox populated, and that when a users selects one of the items in the dropdown that you want that item's text data to be populated in a separate text box?

      E 1 Reply Last reply
      0
      • C cdengler

        More information required here.. Are you saying that you already have the listbox populated, and that when a users selects one of the items in the dropdown that you want that item's text data to be populated in a separate text box?

        E Offline
        E Offline
        ekendricks
        wrote on last edited by
        #3

        Correct: This list box is already populated using a SQL stmt. User can currently select an item in the dropdown. The fields in the list box are ID=1d, and Value=Name which is displayed to user. The SQL stmt returns: ID - Name - Dept. I need an onchange event that will populate another text box "Dept" with the 3rd column of the list box "Dept". Thanks Ernest

        C 1 Reply Last reply
        0
        • E ekendricks

          Correct: This list box is already populated using a SQL stmt. User can currently select an item in the dropdown. The fields in the list box are ID=1d, and Value=Name which is displayed to user. The SQL stmt returns: ID - Name - Dept. I need an onchange event that will populate another text box "Dept" with the 3rd column of the list box "Dept". Thanks Ernest

          C Offline
          C Offline
          cdengler
          wrote on last edited by
          #4

          Ok, if I understand this, what you're saying is that you have three values... the ID, the name and the Department. And now based upon which one they select, you need to populate another area with the department value. I would create a Javascript array on the page populated when the SQL populates the dropdown. The array would contain the IDs of each dropdown associated with DEPARTMENT. On the OnChange, have the script look up the value of the selected item in the dropdown, get the department value, and populate the other area. Make sense?

          E 1 Reply Last reply
          0
          • C cdengler

            Ok, if I understand this, what you're saying is that you have three values... the ID, the name and the Department. And now based upon which one they select, you need to populate another area with the department value. I would create a Javascript array on the page populated when the SQL populates the dropdown. The array would contain the IDs of each dropdown associated with DEPARTMENT. On the OnChange, have the script look up the value of the selected item in the dropdown, get the department value, and populate the other area. Make sense?

            E Offline
            E Offline
            ekendricks
            wrote on last edited by
            #5

            Yep... you understand..... Thanks for the reply..... Now I just need to find samples or figure out how to do just that.. Thanks Ernest

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups