Forum OpenACS Q&A: Re: Finding a specific FORM using DOM in Mozilla

Posted by Jerry Asher on
Learned a lot today. Yes, that means by forehead is sore and the wall needs more spackle.

In a nutshell, this page contains a bookmarklet to fill out the washingtonpost's information gatherer. Ironically, since the wapo doesn't ask me to login, but provides me with a form for demographic information, they are perhaps more respectful of my privacy than say the NY Times or the LA Times. Implementationwise though, NY Times and LA Times logins can be memorized by my browser. (Damn, and I just realized Mozilla as this Form Manager that may have eliminated this education for me....) Anyway at the cost of convenience, I too, will toss away some privacy. (Assuming the logins and/or the demographics contain valid information.)

Visit the page, and if you're using Mozilla, drag the link to your toolbar. It uses "Level 0 DOM" so it should work in IE and Opera. Perhaps.

If anyone wants this, you should change the information as appropriate. Right now it is set for a male, born in 1965 in the 20171 zip code.

I found the DOM Inspector useful, but not usable. I am just a novice with it, but I think it needs to be able to quickly show the entire tree all at once, and then use filters to get rid of uninteresting nodes. And it's a bit buggy too. And it's incredibly hard to actually change values within the DOM, and if you do succeed, the changes, while there, are not reflected in the displayed page.

Venkman, the JavaScript debugger is pretty cool. The trick for me was figuring out WHERE TO TYPE to it. It turns out that a relatively obscure and unlabeled box at the bottom of the black (by default) console window is the place for typein. I kept trying to type in to the console output window itself, and was confused in part, because it accepts type in like most Mozilla pages, but responds to it by turning the type in into an incremental search string.

IMNHSO, Venkman should be better integrated with the DOM Inspector. I can't inspect objects from Venkman, unless they are already variables in the local stack frame. I should just be able to look at a DOM pane within Venkman. What's nice is that if within Venkman, you change DOM values, the changes do show up immediately, at least they did in my testing of this form.

So basically, I got this to work with DOM Level 0 (which doesn't really exist) and didn't try the new and improved DOM. However, there is a great tutorial on the new DOM and JavaScript techniques here.