Click here to Skip to main content
13,189,811 members (57,484 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi friends,

I want to populate a combobox in Html with the contents of a file when the page containing the conmbo box is loaded in a browser. The text file contains some names

for example:-
Text file name : "names.txt" and contents are..


each name is in single line. i want to add these names in a combobox option at run time since these names keeps changing. Hope you understood the problem. please help me as soon as possible with a sample code.

Posted 4-Mar-13 16:52pm
I wonder why having this file. May be this is a good idea, but please explain. Are you going to change this file or something? Why not embed this data in HTML or JavaScript?
Member 9470684 4-Mar-13 23:28pm
Actually my requirement as follows.
There is a directory which contain some files. i want to fetch those file names from the directory n load it into the combobox in html page. since the files in the directory keeps changing so the names in combobox must also change according to the contents of the directory. the user accesing the webpage should be able to select a filename from the combobox.
Member 9470684 4-Mar-13 23:29pm
so for this i thought of storing all file names in a seperate text file n loading the combobox from that text file. i saw a load method of jquery which load the contents of a file in a html element. so i thought of this technique.. if you have any other way to do this, plz tell me..
On client side? All of those artifacts? Why? Do you have any server-side technology, by the way?
And I still don't know to purpose of it; it does not sound reasonable to me...
Member 9470684 5-Mar-13 2:08am
ya, i want the client to see the files that are available in the directory, without giving him the access to browse that directory. so i just want to show the files that are currently inside the directory when the page is loaded.we are using shell scripts and a perl.
Do you understand that JavaScript has no access to local system? The whole think is just the bad idea.
Member 9470684 5-Mar-13 2:32am
thats why i was storing filenames in a seperate file using shell script and then reading this file. i think jquery has access to local system. may be m wrong but i read about load method of jquery which can load the content of a file which is in local system into a html element. my requirement is like this, so if u hav an alternative. plz hav more experience than me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171016.2 | Last Updated 4 Mar 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100