473,729 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populate HTML Form from Text file...

Does anyone know how to populate form fields on a html web page (client
side) with data from an Excel file (CSV) or text file. I am currently having to
input data to many text fields manually. I would like to transfer the data into the
web form programatically from a CSV/text file. How can this be done? I am
new to javascript, but I will work through the challange if possible. Please help!
Thanks.
Jman

--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Jun 28 '08 #1
7 7334
jc****@none.com wrote on 28 jun 2008 in comp.lang.javas cript:
Does anyone know how to populate form fields on a html web page
(client side) with data from an Excel file (CSV) or text file. I am
currently having to input data to many text fields manually. I would
like to transfer the data into the web form programatically from a
CSV/text file. How can this be done? I am new to javascript, but I
will work through the challange if possible. Please help!
If this is an "only once" task, just convert the textfile by text editor to
a javascript array, that you then make part of the javascript of your html
page, [or call as an local external .js file, if your html is also local].

"field1","field 2","field3","fi eld4"
"2field1","2fie ld2","2field3", "2field4"

becomes:

var myArray = [
["field1","field 2","field3","fi eld4"],
["2field1","2fie ld2","2field3", "2field4"]
];

field 2 of the second row is accessed as:

var result = myArray[1][1];

=========

If this is a more habitual task, doing this serverside
by serverside coding, would be easier,
as access to text, etc. files
by code is no problem on the server.

Accessing a file on the client from and with browser javascript
would be seen as a security violation under normal browser settings.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 28 '08 #2
Evertjan,
Thanks for your reply.
This process will need to be done on a regular basis and I will not
have access to the server. It must all be done client-side. I am
provided a form online which has many input fields including text
fields, radio buttons and checkboxes. My imput data is in a text/CSV
file and is manually imput into the form. I want to use javascript
to cycle through the text file and input the data into the form. The
form includes text fields, radio buttons and checkboxes.
Any help, code, links etc. is greatly appreciated. Thanks.
Jman
--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Jun 28 '08 #3
jc****@none.com wrote on 28 jun 2008 in comp.lang.javas cript:

[please always quote on usenet, this is not email]
This process will need to be done on a regular basis and I will not
have access to the server. It must all be done client-side. I am
provided a form online which has many input fields including text
fields, radio buttons and checkboxes. My imput data is in a text/CSV
file and is manually imput into the form. I want to use javascript
to cycle through the text file and input the data into the form. The
form includes text fields, radio buttons and checkboxes.
Why javascript?

And where do you put your javascript
if the page with the form is not yours?

And where is your text file located?

Is it only your personal browser on your own PC?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 28 '08 #4

"Evertjan." <ex************ **@interxnl.net wrote in message
news:Xn******** ************@19 4.109.133.242.. .
jc****@none.com wrote on 28 jun 2008 in comp.lang.javas cript:

[please always quote on usenet, this is not email]
>This process will need to be done on a regular basis and I will not
have access to the server. It must all be done client-side. I am
provided a form online which has many input fields including text
fields, radio buttons and checkboxes. My imput data is in a text/CSV
file and is manually imput into the form. I want to use javascript
to cycle through the text file and input the data into the form. The
form includes text fields, radio buttons and checkboxes.

Why javascript?

And where do you put your javascript
if the page with the form is not yours?

And where is your text file located?

Is it only your personal browser on your own PC?
I have done this by using frames in an HTA.
Put the "Remote" document in Frame2 with the JScript code in Frame1.

The stuff I have is about 5 years old, but still works.

You have to look at the source of the remote page to get the Fields ID or NAME,
then in the create the TextFile data in Name/Values pairs.

The JScript code hasn't been updated nor do I use JScript very often.

The Zip is at http://www.byerley.net/AutoFill.zip

There is a ReadMe in the Zipper.

Don't be a critic of the JScript or anything else, it was an exercise as proof
of concept at the time.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jun 28 '08 #5
On Jun 28, 1:33*pm, "MikeB" <m.byerleyATVer izonDottieNetti ewrote:
>
You have to look at the source of the remote page to get the Fields ID orNAME,
then in the create the TextFile data in *Name/Values pairs.
The JavaScript code can be can be injected into the page via a
bookmarklet :

http://tinyurl.com/6y3b43

(Tested in Safari, Opera, FF2, FF3)

--Jorge.
Jun 28 '08 #6
"In resonse to Evertjan:
- What language will accomplish this? javaScript or whatever
language will work is fine.
- Precisely, where do I put the javascript or whatever language to
make it affect a seperate page? I am tryin to figure this out.
- The text file data to fill the form is on my computer.
- The browser is on my personal computer.

Thanks for your help

--
--------------------------------- --- -- -
Posted with NewsLeecher v3.7 Final
Web @ http://www.newsleecher.com/?usenet
------------------- ----- ---- -- -

Jun 28 '08 #7
jc****@none.com wrote on 28 jun 2008 in comp.lang.javas cript:
"In resonse to Evertjan:
- What language will accomplish this? javaScript or whatever
language will work is fine.
Ah, but only javascript is on topic here.
- Precisely, where do I put the javascript or whatever language to
make it affect a seperate page? I am tryin to figure this out.
Well, if you do not have the js interpreted by your browser js-engine,
but say use it in cscript, then there is a whole different situation.
- The text file data to fill the form is on my computer.
- The browser is on my personal computer.
Then you will need the access that txt file from your browser.

The .hta way, as suggested by mikeB, is a good choice,
but fails is the external form file needs cookies, I think.

Using a favelet and changing the text file
to an array containing .js file,
seems another good option.

Now it seems time for you to start experimenting, Jman.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jun 28 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
8145
by: alex | last post by:
Hi, I am looking for a way to populate an HTML table from an external local text file which looks like this: DATE/TIME LAT. LON. DEPTH. ML. -------------------- ---------- ---------- ------- ------- 21/03/2005-04:06:03 XX,XX XX,XX 171 3,42 21/03/2005-12:23:53 XX,XX XX,XX 500 5,4 21/03/2005-12:43:10 XX,XX XX,XX 553 5,38
2
18087
by: C. David Rossen | last post by:
Hello: I have a registration form for classes. Each class has a fee. I have a drop down box whereby the user chooses his class. There is a textbox with the associated fee. I would like to auto populate the fee textbox depending on what class the user chooses. In the email, the value of the drop down box has to be the name of the class and the value of the fee text box has to be the fee. Can someone please help me in accomplishing...
2
4940
by: James Goodman | last post by:
I have a listbox named sub1 on an asp page. I need to fill this list with values from a table. These are selected based upon the selection of a value/s in another listbox. It was suggested that I use a hidden iframe on my main page, & carry out the processing inside the frame, using jscript. If I open the page in a browser, & make a selection in the first listbox (named main), the data in the frame appears to be processed correctly, the...
1
3609
by: jzhang29 | last post by:
I have a JSP page and it contains a dropdown list called Office. What I try to do is: When I select different office from this list, the information of office (address, phone,etc) will be populated in same JSP page. I have a java bean called officeBean that contains all the office information.
10
2732
by: Craig Keightley | last post by:
I have the following array: function showCPUs(){ //name brandID dualCore dualProcessor var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=; var cpuItem=;
3
6897
by: Yi Chen | last post by:
We have a drop down list on a PHP page, with several product names, and when people click one item, we will refresh the same page with the product name as parameter, and in turn we want to include a HTML file into the content area of the same page. I know it is recommended to put everything into database, but we want the web site to be very "portable", so the drop-downlist and the content should both in text files. Let's say the...
1
6527
by: vj | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file? I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to java class which creates a xml file based on values entered in dynamic jsp page. Now i want to read all those values entered to xml in my other jsp page. I am able to call values from file in my jsp page. But as dynamic values can be any in no...
0
4068
by: vijendra | last post by:
How i can populate all fileds dynamically in jsp page based on contents found in xml file?I have written jsp servlets and java class file. i transferred automatic data from jsp to servlet then to java class which creates a xml file based on values entered in dynamic jsp page. Now i want to read all those values entered to xml in my other jsp page.But as dynamic values can be any in no i don't know how could i populate all those in my jsp...
8
1824
by: freelance71 | last post by:
I have a combo box (select) and when the user selects a value I want to populate an HTML table from DB depending on the value selected. Whats the easiest way to achieve it. I've searched google and the examples require java script. Is there a way to do this with only PHP. I had the impression you could do anything with PHP. Infact there is a book titled 'How to do every thing in PHP'! -- When you argue with a fool, chances are he's doing...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2163
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.