[thelist] javascript default event handlers, default events. [TIP]

VOLKAN ÖZÇELİK volkan.ozcelik at gmail.com
Thu Sep 1 04:22:41 CDT 2005


>That's cool if that's your goal.  To me, it's a weird goal to have.  Not one
>I think serves any benefit to my customer, it's just academic in my mind.

That's another point of view of course. It wil not give any benefit to
your customer. And your customer is who has $$$ in his hand. Therefore
they should be satisfied at all costs.

I do not want to dramatize things but there are people on the world
who can't use javascript for certain accessibility reasons. Be it a
visual impairment, a motor inability or any other exceptional
situation. And if you have met some of them you will be surprised how
ambitious they are, how they are willing to suck knowlegde. You'll be
surprised when you see their will to live.

You are on your own to keep your markup in your code or in a -say
codebehind- js file. imho either approach will work as long as you
know what you are doing.

And here is a sample (from a real web app) of one who does not know
what s/he is doing.

(I've not altered the code just snipped parts of it)

<form method="post" id="form" name="form" onsubmit="doSubmit()">

...

<input type="button" name="btnSend" onclick="processForm()" >
</form>

js.
---

/*to prevent accidential form submit when clicking enter on a textbox*/
function doSubmit(){
    return false;
}

function processForm(){
   ... do some validation ...
   form.submit();
}

----------

You may name both doSubmit and processForm as interfaces. But the code
is an accessibility disaster.

When we flip the other side of the coin; taking processForm and
doSubmit to backend and attach them via some event handling mechanism;
we will not change anything. The application will still be an
accessibility disaster.

Hope you see why it is.

To repeat myself; -imho- one is free to follow whichever approach s/he
is comfortable with.

I *strongly* vote for the unobstrusive one, that's my personal
preference. I will defend it as much as I can. But this will not take
the discussion anywhere.

As one has mentioned, we are drawing circles here and seem to go nowhere.

The only fact is that either approach can be abused if you don't know
what you are doing.

You are on your honor to care for the (you name it) minority.

Cheers,
Volkan.


More information about the thelist mailing list