Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18936 > unrolled thread
| Started by | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| First post | 2013-03-18 12:55 -0700 |
| Last post | 2013-03-18 17:45 -0700 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.javascript
'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
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2013-03-18 12:55 -0700 |
| Subject | 'onblur' problem |
| Message-ID | <aqp9q0FijugU1@mid.individual.net> |
HI:
I have a <select> tag on a page that is on focus as soon as the user
opens the page with his browser, and also that has the following 'onblur'
property:
<select etc, etc., onblur="chkentrymethod();" >
...several options here ...
</select>
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 !
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.
Thank you.
--
Mel Smith
[toc] | [next] | [standalone]
| From | Stefan Weiss <krewecherl@gmail.com> |
|---|---|
| Date | 2013-03-18 21:14 +0100 |
| Message-ID | <ki7sjh$56g$1@news.albasani.net> |
| In reply to | #18936 |
On 2013-03-18 20:55, Mel Smith wrote: > I have a <select> tag on a page that is on focus as soon as the user > opens the page with his browser, and also that has the following 'onblur' > property: > > <select etc, etc., onblur="chkentrymethod();" > > ...several options here ... > </select> > > 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. > 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 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. - stefan
[toc] | [prev] | [next] | [standalone]
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
|---|---|
| Date | 2013-03-18 17:45 -0700 |
| Message-ID | <aqpqq9FmbfdU1@mid.individual.net> |
| In reply to | #18937 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web