How can I use a data field from a variety of data record to populate a drop-down box?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andersond
    New Member
    • Feb 2007
    • 110

    #1

    How can I use a data field from a variety of data record to populate a drop-down box?

    I have a web application that allows retail insurance agents to get quotes 24/7. There is a data file for quotes, a data file for vehicles, a data file for drivers and a data file for agents/producers. At any give retail insurance agency (agent) there my be a variety of people selling insurance (producers). There is a separate record for each producer. All producers in that agency have the same code in the agent field but a different code in the producer field. The agent code determines which agency gets the commission for that sale, in general.. And, the producer code determines which person in that agency gets commission for a specific sale.

    So, I want to be able to populate a drop-down box with the names of each producer in a given agency. That way a clerical person can make submissions for different producers without having to log out and log back in. How can I do this?
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    only to clarify: you don't have a database but just files?

    Comment

    • andersond
      New Member
      • Feb 2007
      • 110

      #3
      Yes; but, all the data for the drop-down box will come from the Producer field in the users file.

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        are those files text-files? ... you might request that with a XMLHttpRequest but i think it would be better to prepare the data serverside with the help of PHP for example ... or the serverside language that you prefer.

        kind regards

        Comment

        • andersond
          New Member
          • Feb 2007
          • 110

          #5
          I am currently using .dbf files from ur enterprise system

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            are you able to get the data out of that files? i think you need to make a programmtical join of the data to get what you want ... it is certainly no JavaScript question since you would need to handle the dbf-files serverside ...

            Comment

            • andersond
              New Member
              • Feb 2007
              • 110

              #7
              I can definitely get the data out of the files client side or server side. Are you saying that if all the Producers are in the same record that I could use those fields to populate the drop-down?

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5390

                #8
                for a dropdown you would need to create a select-node and the needed option nodes for it. i'm a bit confused .... what is your exact problem? your files are like tables of a DB and so by knowing where the data are stored and how to join it ... what is your question?

                kind regards

                Comment

                • andersond
                  New Member
                  • Feb 2007
                  • 110

                  #9
                  My question is "How can I use javascript to populate a drop-down menu that would be used to select which producer is to get credit for a given sale?" Some agencies may have only one producer while others may have 40.

                  Comment

                  • gits
                    Recognized Expert Moderator Expert
                    • May 2007
                    • 5390

                    #10
                    here is a quite simple example ... you might test it with a plain HTML page:

                    Code:
                    var selectNode = document.createElement('select');
                    
                    for (var i = 0; i < 10; ++i) {
                        var optionNode = document.createElement('option');
                        
                        optionNode.value = i;
                        
                        var text = document.createTextNode(i);
                    
                        optionNode.appendChild(text);
                    
                        selectNode.appendChild(optionNode);
                    
                        document.getElementsByTagName('body')[0].appendChild(selectNode);
                    }
                    this will create a select node with 10 options ... and append it to the document's body

                    kind regards

                    Comment

                    Working...