Chaz Meyers (cpm) wrote,
Chaz Meyers
cpm

Bookmarklet to fill in forms with prototype.js.

Lately I have had to make too many forms with too many fields. I got angry at the prospect of filling in yet another form with dummy data, so I created a bookmarklet to fill the forms in with garbage.

I've only used this in firefox, and it assumes that prototype.js is loaded on the page you're using. Furthermore, it only fills in textarea, input text, and radios. Very niche! I just am putting it up here because otherwise I'll lose it and have to spend 10 minutes of my life writing this code again.

javascript:$$("input[type=text], textarea").each(function(f){ f.value = f.name + " random value"}); $$("input[type=radio], input[type=checkbox").each(function(f) { f.checked = true }); undefined

Similarly, here's a bookmarklet to clear forms:
javascript:$$("input[type=text], textarea").each(function(f){ f.value = ""}); $$("input[type=radio], input[type=checkbox").each(function(f) { f.checked = false }); undefined
Tags: bookmarklet, code, computers, for me, javascript, nerdcore, software
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments