Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Extracting The Values Of All Forms On The Page

DZone's Guide to

Extracting The Values Of All Forms On The Page

·
Free Resource
This is a simple piece of javascript intended to be run from Firebug or as a bookmarklet which extracts all the name : value pairs from forms on the page and pops up a new window listing them.

It's not very well written, and doesn't yet handle any non input form elements, but it will do for now. :-)


var displayWindow = window.open();

function showFormValues(form ) { 
    displayWindow.document.write('Form:');
    displayWindow.document.write(form.name);
    displayWindow.document.write('
'); var formElements = form.getElementsByTagName('input'); for (var i = 0; i < formElements.length; i++){ var element = formElements[i]; displayWindow.document.write(element.name + ' : ' + element.value + '
');}} Array.forEach(document.forms, showFormValues);
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}