Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: HTML5/CSS
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 17:52pm
Sergey Alexandrovich Kryukov at 4-Mar-13 23:06pm
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 at 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.
Sergey Alexandrovich Kryukov at 5-Mar-13 0:39am
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 at 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.
Sergey Alexandrovich Kryukov at 5-Mar-13 2:22am
Do you understand that JavaScript has no access to local system? The whole think is just the bad idea.
Member 9470684 at 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.
Member 9470684 at 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..

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

  Print Answers RSS
0 OriginalGriff 685
1 Maciej Los 290
2 Richard Deeming 185
3 Suvendu Shekhar Giri 184
4 Abhinav S 166
0 Sergey Alexandrovich Kryukov 9,678
1 OriginalGriff 9,135
2 Peter Leow 5,082
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,606

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 4 Mar 2013
Copyright © CodeProject, 1999-2015
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