Skip to Content

TUAW Responds: Reader Requests iPhone Javascript Pasting

TUAW reader jadam asks if someone would please code up a bookmarklet that allows you to paste into website fields. It's a bit of a hack but I've put together this bookmarklet that you can sync to your iPhone and paste a pre-defined phrase into Safari.

This version pastes the word TUAW but you can easily replace TUAW (defined by "replacetext") with any other phrase. The bookmarklet iterates through all the form fields on your page, allowing you to select where to paste. You're welcome, jadam!



TUAW reader jadam asks if someone would please code up a bookmarklet that allows you to paste into website fields. It's a bit of a hack...
 

Add a Comment

*0 / 3000 Character Maximum

8 Comments

Filter by:
Krioni

Phillip,

There is a "Personal Note..." bookmarklet that does what you mentioned. If you use that, and the variable name it uses is "iJ62mQcy" (see http://edmullen.net/Mozilla/bookmarklets.txt for more) then here is a version of iPastelet that will allow you to paste that text into form fields (after only typing it once):
javascript:var%20i,j,holdorig;var%20replacetext=iJ62mQcy;for%20(i=0;i%3Cdocument.forms.length;i++)for%20(j=0;j%3Cdocument.forms[i].elements.length;j++){if%20(document.forms[i].elements[j].type==%22text%22){holdorig=document.forms[i].elements[j].value;document.forms[i].elements[j].value=replacetext;var%20answer=confirm(%22Paste%20Here?%22);if%20(answer)%20break;%20else%20document.forms[i].elements[j].value=holdorig;}}

January 26 2008 at 6:03 PM Report abuse rate up rate down Reply
mobilemind

I thought this was pretty cool, so I hacked up a little web page with a form. Just enter the text you want the bookmarklet to paste and the name you want to give the bookmarklet. Very handy for making a little scrapbook of common web form text- email addresses, host and server names, etc. The form is at:
http://mobilemind.net/iphone/ipastelet.html

Thanks TUAW and thanks Erica.

December 09 2007 at 3:11 AM Report abuse rate up rate down Reply
webcrs

I tried this out and it works just fine on safari on my pc, but when I sync it to my iPhone it doesn't do anything. I don't get any of the dialog boxes. I will disclaim that I am running safari on windows, not a mac. I have had a lot of problems with bookmarklets that are too large for safari on the pc, but they typically don't work on safari on the pc.

Any thoughts?

December 08 2007 at 10:35 AM Report abuse rate up rate down Reply
Phillip Platz

The iPhone uses cookies, doesn't it? If so, is it possible for a "copy" bookmarklet to store selected text to a "clipboard" cookie, and a "paste" bookmarklet to iterate through all the fields and paste from the clipboard cookie? Just a random thought which probably won't produce much fruit anyway...

December 07 2007 at 3:25 PM Report abuse rate up rate down Reply
1 reply to Phillip Platz's comment
Phillip Platz

And then I remember that the iPhone can't *select* text. Hmm.

December 07 2007 at 3:27 PM Report abuse rate up rate down Reply
jadam

Thanks Erica! This will undoubtedly prove useful for pasting info like addresses, etc. into web forms. I'll be setting a few of these up for sure.

December 07 2007 at 3:18 PM Report abuse rate up rate down Reply
punkassjim

If anyone has a good repository of bookmarklets for the iphone, please post up. I've found a ton I like, but in particular I'm looking for one that'll allow you to use a search engine that requires the POST method. All the usual ones, like dictionary.com and wikipedia, etc, all use the GET method (putting strings in the URL). I haven't found a single one that gets around the POST requirement.

December 07 2007 at 2:58 PM Report abuse rate up rate down Reply
Kim Hill

If your pasted text includes special characters (as in a URL), do you have to escape them to use this script?

December 07 2007 at 2:21 PM Report abuse rate up rate down Reply
Buy an ad here

Hot Apps on TUAW

Tweets

© 2012 AOL Inc. All Rights Reserved.