www.onebee.com

Web standards alert

Account: log in (or sign up)
onebee Writing Photos Reviews About

JavaScript, I loathe you—4:11 PM

The vast majority of items in the reviews database will not include a formal write-up. There will be more than 500 items and I don't have time to go back and review 'em all!

However, there will be an opportunity to request a review of any item. The idea being, if I someday have a lot of free time and nothing to write about, I'll sort through the most requested items and write a review.

I really wanted a little checkbox that you would click to request a review, which would automatically submit the form. But a form's onSubmit event handler isn't invoked if the submission comes from an onClick handler on the textbox! And I could find no way to return a true/false status from my little Ajax script for submitting the request without refreshing the page! So, I had to go with a submit button instead of a checkbox.

Damn you, JavaScript!

4 Comments (Add your comments)

Jeff TidballThu, 8/11/05 5:48pm

I know not the how, the I noticed today that Bloglines (bloglines.com) has a "keep as new" checkbox that you can use to mark a given post to an RSS feed, and then bloglines will decline to mark it as read after it's been noted. This is somehow done without a submit button. (Which confused me... because I was looking for one to "activate" my checkbox selection. I was surprised to discover that they had activated themselves.)

I don't know if that's useful to this case or not, but there it is.

Bee BoyThu, 8/11/05 6:41pm

Yep, Bloglines appears to be using frames, so the onClick handler of the checkbox reloads the page in the feeds frame. Which is similar to how this functionality would work if I wanted to reload the page, but I only want to reload the page in the event that the Ajax script doesn't work (as a fail safe).

A complication which is, admittedly, entirely my own fault. But these are the trade-offs when you have an insane lunatic as a web design client. Thanks very much for the tip, though (and please ignore the groans of the onebee readership, dismayed at the encouragement which will only perpetuate my posting of geeky codespeak).

Jeff TidballThu, 9/8/05 9:44am

Stumbled across another widget where check-the-box causes action without a button press, and seems to not reload the page. When checking off a to-do item on a Ta-da List (www.tadalist.com), it moves to the bottom of the list and changes style. Any idea what's at work there?

Bee BoyThu, 9/8/05 10:25am

The aforementioned onClick handler yet again. You can believe I investigated Ta-Da List first – 37signals is my top resource for stealing code. I need the form to still submit if the Ajax doesn't work, because I'm trying to support as many browsers as I can. 37s – with their haughty, devil-may-care swagger – has sworn off Mac/IE 5. I wish I could, too, but I think people are still using it.

Holly, what browser are you using these days?

Jeff, if you don't get e-mail about this comment, I'm selling all my possessions and moving to a hut in Tibet. :-)

Your Comments
Name: OR Log in / Register to comment
e-mail:

Comments: (show/hide formatting tips)

send me e-mail when new comments are posted

onebee