View Full Version : Question about bookmarklets
Basscyst
10-15-2004, 09:43 PM
Is there a way for me to load a page (That's not mine) containing a form. Then so long as I know the name or location in the DOM of the form and it's elements, specify the values in the elements upon load of the page? Basically there is a form I always fill out with the same info and it would be cool if I could bookmark it and load it already filled.
Thanks,
Basscyst
Willy Duitt
10-15-2004, 10:20 PM
Yes it is very possible... The only limititations being that Bookmarklets have a 256 character limit but that could be worked around by using an external javascript file if necassary....
It would help to see the form and examples of the information you would like to use but below is a brief example of one I often use to fill in online forms asking for information I have no intention to reveal...
javascript:function ROIoiW(){var i=0,j,A='anonymous',D,E,F=document.forms;while(i<F.length){E=F[i].elements;for(j=0;j<E.length;j++){D=E[j];if(D.type=='text'){D.value=(D.name.toUpperCase().indexOf('MAIL')!=-1)?A+'@example.com':A}}i++}}ROIoiW();void(null)
.....Willy
Basscyst
10-15-2004, 10:29 PM
Thanks Willy,
I was able to get that far, only problem is, I don't want to have to go to the page first.
http://www.levels4you.com/search.l4y?type=files
I really just want Red Faction to be selected on the first select anytime I load the page. I actually have a feedback thread about it in the forum (Trying to get them to make an option to remember your preference), but trying to muster up a resolution on my own. In thinking about it, perhaps if I pop it open in a new window it would work, tried using window.loaction.href before referncing the form, but of course that brings you to a new page and wipes out the rest of the bookmarklets code.
Here is what I have so far, still not working, wondering if it's even possible
javascript:function changeSel(){win.document.forms[2].elements[2].options[6].selected=true;}var win=window.open('http://www.levels4you.com/search.l4y?type=files','search');win.document.onload=changeSel();
Basscyst
Basscyst
10-17-2004, 05:39 PM
**cough** Could I get some assurance that this is \ is not possible? :o
Willy Duitt
10-17-2004, 07:49 PM
...only problem is, I don't want to have to go to the page first.
You need to wait until after the page is loaded before you can run a javascript bookmarklet snippet...
So yes, the answer is it is not possible for you to run a script before you visit the page and the page loads...
.....Willy
If you're using Fx you could use this: http://autoform.mozdev.org/
Not a bookmarklet though.
brothercake
10-17-2004, 08:56 PM
afaik the 256 character limit is only in IE - FF should let you have up to 4K
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.