By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,259 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,259 IT Pros & Developers. It's quick & easy.

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

100+
P: 110
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?
Feb 18 '10 #1
Share this Question
Share on Google+
9 Replies


gits
Expert Mod 5K+
P: 5,390
only to clarify: you don't have a database but just files?
Feb 18 '10 #2

100+
P: 110
Yes; but, all the data for the drop-down box will come from the Producer field in the users file.
Feb 18 '10 #3

gits
Expert Mod 5K+
P: 5,390
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
Feb 18 '10 #4

100+
P: 110
I am currently using .dbf files from ur enterprise system
Feb 18 '10 #5

gits
Expert Mod 5K+
P: 5,390
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 ...
Feb 18 '10 #6

100+
P: 110
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?
Feb 18 '10 #7

gits
Expert Mod 5K+
P: 5,390
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
Feb 18 '10 #8

100+
P: 110
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.
Feb 18 '10 #9

gits
Expert Mod 5K+
P: 5,390
here is a quite simple example ... you might test it with a plain HTML page:

Expand|Select|Wrap|Line Numbers
  1. var selectNode = document.createElement('select');
  2.  
  3. for (var i = 0; i < 10; ++i) {
  4.     var optionNode = document.createElement('option');
  5.  
  6.     optionNode.value = i;
  7.  
  8.     var text = document.createTextNode(i);
  9.  
  10.     optionNode.appendChild(text);
  11.  
  12.     selectNode.appendChild(optionNode);
  13.  
  14.     document.getElementsByTagName('body')[0].appendChild(selectNode);
  15. }
this will create a select node with 10 options ... and append it to the document's body

kind regards
Feb 18 '10 #10

Post your reply

Sign in to post your reply or Sign up for a free account.