Bookmarklet Generator
Overview
Practically every web-related job I've ever had, I've found myself constantly having to enter and re-enter information into forms for testing purposes. After the 2879879287th of filling in the same form, it REALLY begins to grate on the ol' nerves, as any Quality Assurance (QA) specialist will know.
To remedy this I wrote a simple bookmarklet (see here for a definition of "bookmarklet") to fill in a form automatically - I had to fill in that particular form maybe 10 or 20 times a day, so it was a good candidate for automation. Now, whenever that form stares back at me, I can just click my custom bookmarklet and hey presto! It's filled in. This has saved me a great deal of angst, let me tell you.
So then I figured: hey, this is pretty cool! It would sure be nice to have this functionality for ANY form I come across. Hence the Form Filler Bookmarklet Generator. This little script actually builds javascript bookmarklets for any web form. You just fill in the form, click the bookmark and a window pops open with the bookmarklet(s) for that page. If your page contains multiple forms and each form contains values in at least one field, a bookmarklet will be generated to repopulate it with exactly the same content. Cool, huh?
Requirements / Limitations
- Firefox. (Sorry, but it's high time to drop IE. Trust me).
- Javascript must be enabled
- Form size: due to the maximum length of URLs (~3000+ for Firefox), it won't work for storing a LOT of form information. Best for smaller forms.
- Single quotes in fields will cause problems.
- The script doesn't UNSELECT/UNCHECK checkboxes or multi-select boxes, only RE-selects them.
WARNING
- Don't ever ever ever ever ever ever use this script to store sensitive information like passwords or credit cards! That information is stored in a bookmark in your web browser, so anyone on your computer will be able to access it!
Install
To install it *, just:
- Copy the contents of the textarea below to your clipboard (CTRL-A & CTRL-C on Windows)
- In your browser's toolbar, right click over it and select "New Bookmark"
- Name it "Form Filler" or whatever you fancy, and in the Location field, paste in the contents you just selected (CTRL-V on Windows)
- Continue reading below...
* For you bookmarklet nerds out there, the reason I couldn't just make this a regular link is due to escaping problems in the javascript. Simply escaping the " chars in the javascript is insufficient for a valid, working HTML link. I'd welcome any solutions you might come up with!
Test it out!
By this point, you should have the Form Filler bookmarklet generator installed as a bookmark in your browser. To see how the script works, do the following:
- Fill in the various fields in the two (rather inane) forms below.
- Click the "Form Filler" bookmark that you created earlier.
- You'll see a popup appear containing one or two links. Drag the links to your toolbar: these are now custom-built javascript bookmarklets for populating the form(s).
- Click the reset buttons for each form.
- Click the newly created bookmarklet & see the forms be automatically populated. Neat, huh?
- Now use it on your own forms!
Demo Form: How Brahman are You? |
Demo Form Deux |
If you encounter any bugs or have feature suggestions, please contact me.