Chaz Meyers (cpm) wrote,
Chaz Meyers

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 = + " 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

  • My tweets

    Tue, 19:54: RT @ TheParkerJam: Suppose you are: * in rails in development mode * using cookies for sessions * raising an exception and not…

  • My tweets

    Mon, 12:48: Well, that was an unexpected turn.

  • My tweets

    Fri, 20:07: I made my first comment on a YouTube video. It got 132 upvotes and 28 comments. The clout is definitely already going to my head.

  • Post a new comment


    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.