Christian Heilmann

Posts Tagged ‘datastorage’

Using Twitter as a data provider to automatically fill forms

Thursday, January 8th, 2009

I hate having to enter all my details when I fill forms – especially when I know for a fact that I’ve entered them before. Looking at Smashing Magazine’s Twitter Avatar WordPress Plugin I got to play with the show API of twitter, which gives you user information.

For example to get my information in Twitter you can just call http://twitter.com/users/show/codepo8.xml and get all I entered. This is also available in JSON and with a callback parameter. You can also do a lookup by email, by calling http://twitter.com/users/show/show.xml?email=you@yourserver.com. Using both of these together, I thought it’d be a good idea to use this API to automatically fill forms.

I’ve created a quick proof of concept: automatically filling forms with twitter data . If you want to use the script yourself (twitterfill.js), simply add it to the page with your form and give it the right parameters in the init method. For the demo page this is:




The parameters are label, which is the text of the button, loading, which is the loading message, mailfield, which is the ID of the email field (the button will be inserted after it), and name,location and url which are the IDs of the form fields you want to fill.