This is old content! The graveyard is a snapshot of content created from 2002-2005. For new stuff, visit Maniacal Rage.
 

Weird Safari Bug

posted on october 7, 2003, tag: software

While working today I found a very strange Safari bug. On an order form I was creating, a user must keep a checkbox checked, otherwise they can't submit the order. To facilitate this, I used a simple line of JavaScript. In the onclick attribute of the checkbox, I call a JS function called ableButton() that looks like this:

function ableButton() {
     if (document.order.go_order.checked==true) {
          document.order.submit.disabled = false;
     } else {
          document.order.submit.disabled = true;
     }
}

Now, that works fine (in all modern browsers), and, if the browser supports it (most do), grays out the submit button. This works just fine in Safari. The bug is something else: if you click on the disabled submit button, it does nothing. As it should. But! If you double-click the button, it submits!

It's almost as if Safari believes disabling means, "don't let them use it, unless they seem like they really want to." I tested this in all the other browsers I have, and Safari was the only one that it worked in. Strange.

Comments

There are 2 comments, comments are closed

Paul Griffiths on 10/18/2003:

This is also the same for password inputs in safari. If you try and add the disabled attribute to a password input, Safari still allows the user to enter a password in!

gui weinmann on 07/20/2004:

Interesting comments.

I'm think I may have found another problem with Safari - it seems like any other flavor of javascript allows one to programatically assign the value of a checkbox.

But not Safari.

function resetFormButtons(theForm) {
  counter=theForm.elements.length;
  for (i = 0; i<counter; i++) {
      theForm.elements[i].value='foo';
      // this actually does nothing in safari but works in all other browsers (ie, opera, netscape, mozilla, etc)
   }
}


See Also

View the archive

Original iPod Introduction
How far we've come in just a few short years. Here's where it all started.

Front Row on Non-iMacs
Going to try this tonight!

WriAShorStorWe!
DY starts a one-week short story writing event for people to lazy to enty NaNoWriMo. VerCooIdea.

Lost Rhapsody
Funny Flash movie using Weird Al music and Lost stuff. Lyrics make a surprising amount of sense!

Jed's Other Poem
Unsolicited music video made on an Apple ][. Fantastic!

Printers Output Secret Barcode
The government is keeping tabs on what you print, with the help of major printer companies.

Dreamhost Promo Codes
DH already has very cheap, very good hosting—this just sweetens the deal.

Photos of the new iPod
Just received my new iPod and I put a few photos up.

PEZ MP3 Player
Funny idea that actually looks kind of neat. I like that it comes pre-loaded with "indie" music.

HD Easter Egg
"My Name is Earl" on NBC gives viewers with HD TVs a little easter egg. Cute, but weird.