Dynamically generating contant in a drop-down

garcon

Well-known member
Joined
Dec 13, 2004
Messages
47
Programming Experience
Beginner
Folks,

I have an interesting wee problem. it's with a list box that with variable amounts of elements.
I have to buid a drop-down list box with 8 to 9 elements in it. I say 8 to 9 deliberately as depending on the input to the system it can change.


For example say a list box contain 4 elements which I shall call: "a", "b", "c" and "d". When the page loads I receive some data. If "a" is in this data then the list box must display: "b", "c" and "d" only.

Next time say I receive "c". There fore the list box must contain only "a", "b" and "d".

Thing is though I don't know exactly how to do this. I know how to insert a drop-down list box into a form - sure. But dynamically gnerating content? Would greatly appreciate any suggestions/comments/ideas/code-samples that you would like to share.

Thanks,
G.
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
listbox.items.add("item") or listbox.items.remove("item")
Altrenativly if your data is in a DB then use a WHERE clause in your SELECT statment and then use listbox.datasource = "dataset" and listbox.displaymember = "table.column"

TPM
 
Top Bottom