Monday, April 24, 2006

Saving web form data to file

If you want to use webpages and DHTML to do experiments or fill out questionairs, the problem is saving the data to a file on the hard drive for statistical analysis. If your web-form is on a online webpage this not too difficult (e.g., using a mail-form—see this page). But if you want to collect data offline, you would like to able to save those data to a file on the hard drive. How to get access to the hard disk from within a webpage is explained here, but it is more convenient to have javascript code that works for any form on a webpage. To this end I created a Javascript object that gathers the data from a form, and—in Internet Explorer—can write it to the hard disk in the comma separated values (".cvs") format. Part of the code is based on code from this website. An example and a detailed explanation can be found here. A zip file containing the .js library file and the example and documentation can downloaded here.