Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #18941

Re: 'onblur' problem

From "Mel Smith" <med_cutout_syntel@aol.com>
Newsgroups comp.lang.javascript
Subject Re: 'onblur' problem
Date 2013-03-18 17:45 -0700
Message-ID <aqpqq9FmbfdU1@mid.individual.net> (permalink)
References <aqp9q0FijugU1@mid.individual.net> <ki7sjh$56g$1@news.albasani.net>

Show all headers | View raw


Stefan said:
>> Normal Operation:
>>      If the user fails to 'select' one of the several options in the
>> <select> tag, and instead focuses on another field,  I immediately 
>> 'alert'
>> the user and re-focus back on the <select> element. I do this until he
>> 'selects' one of the options. Works good !
>
> If you say so.
>

    I appreciate your warning about this technique. But my (potential) users 
have decidedly different methods/needs of entering information in this table 
(6 rows, 21 columns of single-character input).  So, they have a choice of 
vertical, horizontal, partial, none, etc, etc) for their preferred table 
entry method.

    The completed table will be abstracted by JS and presented as 6 strings 
of 21 chars each and returned to my server.

    ( and right now, setting the tabIndex for the 130-odd input table fields 
works properly on Chrome, Safari and FF,  but goes 'nuts' in IE8 and IE9. 
And I'm too tired to set up a test page for this groups perusal. Sigh ...)

>> Problem Operation (at least for IE8) :
>>     If the user clicks the 'X' (eXit the browser) button in the top-right
>> corner *before* selecting an option, my IE8 browser senses the 'onblur'
>> event and shows the alert message -- even though by that time the browser
>> has already shutdown.  Very messy of me to allow this.
>>
>> Question:
>>     How can I sense that the user is simply closing down the browser, and
>> stop the onblur event from presenting the alert() message.
>
> I would strongly recommend changing the onblur-alert-focus behavior of
> your form. Forcing the user's focus to where they don't want it is a
> really good way to annoy users. There are better methods for handling
> incorrect or missing form values.
>

    This insistence of establishing a table-entry method is essential.

> This type of obtrusive scripting is what gave JS its bad name.
>
> If you don't care about that, you may be able to get away with a short
> artificial timeout between the blur event and your alert. Closing the
> window should clear the timeout, and the alert() will never execute.


I will check timeout method tomorrow. Seeems like a good idea.

Thank you !

-Mel Smith

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

'onblur' problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-03-18 12:55 -0700
  Re: 'onblur' problem Stefan Weiss <krewecherl@gmail.com> - 2013-03-18 21:14 +0100
    Re: 'onblur' problem "Mel Smith" <med_cutout_syntel@aol.com> - 2013-03-18 17:45 -0700

csiph-web