The Asdf Bookmarklet

Anyone who ends up writing web forms gets tired of going through every field typing "asdf" in each of the blanks during testing. Also, any users of said forms end up getting tired of filling in "asdf" in each of the fields, until the form is satisfied enough for them to move on.

Here's a BookMarklet to automate these tasks. To install the bookmarklet, create a new bookmark, then copy and paste the line of JavaScript code below into the "address" information of the bookmarklet. A BookMarklet is sometimes called a FavLet.

Version 2:

This now handles dropdowns, radio buttons and checkboxes:

 javascript:for(var i = 0; i < document.forms.length; i++) {for (var j = 0; j < document.forms[i].length; j++) {if (!document.forms[i][j].value) {void(document.forms[i][j].value = 'asdf')} if (document.forms[i][j].type == 'select-one') {void(document.forms[i][j].selectedIndex = 1)} if (document.forms[i][j].type == 'checkbox') {void(document.forms[i][j].checked = true)} if (document.forms[i][j].type == 'radio') {void(document.forms[i][j].checked = true)}}}

Tested on:


Version 1:

 javascript:for (var i = 0; i < document.forms.length; i++) for (var j = 0; j < document.forms[i].length; j++) if (!document.forms[i][j].value) void(document.forms[i][j].value = 'asdf')

This is one case where I believe in comments: It just loops over every form and every field, skipping the ones that already have values (so the submit buttons don't their values overwritten), making the rest 'asdf'. The void() surrounding that last statement is to make sure there is no return value (when there's a return value, the browser thinks it's supposed to take you to that value as a URL - very annoying).

Tested on:


TODO:


EditText of this page (last edited October 6, 2004) or FindPage with title or text search