How can I make the page ignore the mousedown event?

J

john

I want the page to completely ignore all mouse clicks. I can create
the onmouseclick event and return false, but that only disables
certain types of things. I can still, for example, click in a text box
and then type something or change the selection in a dropdown list. I
tried returning false in the onmousedown event, but that didn't do the
trick. I'd rather not have to disabled all the controls on the page.
Any ideas?
Thanks in advance,
John
 
K

kaeli

I want the page to completely ignore all mouse clicks.

Bad Idea (tm). I use my mouse for page navigation. Many disabled people
do, too. You ignore all clicks, you disallow mouse navigation. Not good.
I can create
the onmouseclick event and return false, but that only disables
certain types of things. I can still, for example, click in a text box
and then type something or change the selection in a dropdown list. I
tried returning false in the onmousedown event, but that didn't do the
trick. I'd rather not have to disabled all the controls on the page.

Why would they ALL need disabled? If that's the case, just don't allow
form submittal.

If a few need "disabled", but you want them submitted, there's several
solutions to that, depending on what your needs really are. None of them
involve disabling clicking on the main document.


--
 
W

William Morris

I don't have a ready answer for the question, but I am curious why you'd
want to do such a thing?
 
M

Michael Winter

I want the page to completely ignore all mouse clicks. I can create
the onmouseclick event and return false, but that only disables
certain types of things. I can still, for example, click in a text box
and then type something or change the selection in a dropdown list. I
tried returning false in the onmousedown event, but that didn't do the
trick. I'd rather not have to disabled all the controls on the page.
Any ideas?

Read the thread, "Cancel click event an a page" [sic], posted by Paolo
Mancini earlier today. My response to that question is the same.

Author: (e-mail address removed) (Paolo Mancini)
Subject: Cancel click event an a page
Date: 19 Apr 2004 09:36:50 -0700
Msg-ID: <[email protected]>

Mike
 
J

john

Thanks for the responses. It seems that there's no easy way to do what
I want to do. Since two of you have asked why I would want do such a
thing, here is the reason: When the user has clicked on a button that
is causing the browser to post back to the server, it could take a
little while for the new page to show up. So in the mean time, I want
to change the cursor to an hourglass and not allow the user to do
anything with any of the controls on the page.
 
B

Brian Genisio

john said:
Thanks for the responses. It seems that there's no easy way to do what
I want to do. Since two of you have asked why I would want do such a
thing, here is the reason: When the user has clicked on a button that
is causing the browser to post back to the server, it could take a
little while for the new page to show up. So in the mean time, I want
to change the cursor to an hourglass and not allow the user to do
anything with any of the controls on the page.

Blur the controls (using blur()) and do not allow for form submittal.

It is a lot better than making the browser look like it is froze.

Brian
 
W

William Morris

If THAT's all you want to do, then here's a possible solution: have a
message inside some sort of container that says "Please Wait..." or somesuch
that is adjacent to the Submit button and is hidden when the page loads.
When you click "submit", hide the button, show the message, and if you like
change the document.body.style.cursor = 'wait' (warning: NOT cross-browser).
You'll probably have to replace the Submit button with a "button" button,
with an onClick event handler that toggles visibility and then
form.submit()'s. If you really want to walk down the verbose road, loop all
of the form elements and set disabled=true (warning: NOT cross-browser).
YMMV.

Here's the deal, John: once the user clicks the button and the form has been
submitted, the user can do whatever they want to the page and they're not
going to change what was sent: it's already gone. You can take the submit
button away to prevent them from submitting again, which is what it sounds
like you really want to do anyway. We do this sort of thing all the time in
our own web applications.

- Wm
 
K

kaeli

Thanks for the responses. It seems that there's no easy way to do what
I want to do. Since two of you have asked why I would want do such a
thing, here is the reason: When the user has clicked on a button that
is causing the browser to post back to the server, it could take a
little while for the new page to show up. So in the mean time, I want
to change the cursor to an hourglass and not allow the user to do
anything with any of the controls on the page.

That's a very bad idea. I tried something similar. When the server had
issues and the page timed out, the user had no way to resubmit the form.
They had to refresh the page, thereby losing any changes they made.

Better to just pop up an alert or put in text on the page indicating
that processing has started. That's what I ended up with.

--
--
~kaeli~
Why do they lock gas station bathrooms? Are they afraid
someone will clean them?
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 
M

Michael Winter

(e-mail address removed) enlightened us with...

[disable controls and display hourglass]
That's a very bad idea. I tried something similar. When the server had
issues and the page timed out, the user had no way to resubmit the form.
They had to refresh the page, thereby losing any changes they made.

Better to just pop up an alert or put in text on the page indicating
that processing has started. That's what I ended up with.

Assuming that the delay is due to server processing and returning the
results, not sending the data, would it be feasible to return a small
intermediate page that would forward the user to the results page? As most
browsers retain form values, a user could still use the Back button to
return to the first page if the connection fails for some reason. The only
disadvantage I see at the moment is that temporary storage is needed on
the server to store the data during the transition.

You have more server-side knowledge than I do. What do you think?

Just a thought,
Mike
 
M

Michael Winter

If THAT's all you want to do, then here's a possible solution: have a
message inside some sort of container that says "Please Wait..." or
somesuch that is adjacent to the Submit button and is hidden when the
page loads.

It would be more reliable to show a permanent message above the submit
button that informs the user that the results may take some time to return
and that the user should be patient.
When you click "submit", hide the button, show the message, and if
you like change the document.body.style.cursor = 'wait' (warning: NOT
cross-browser). You'll probably have to replace the Submit button with a
"button" button, with an onClick event handler that toggles visibility
and then form.submit()'s.

An interesting idea. However, it might be more easily accomplished by
something like

function toggleSubmit( button ) {
button.value = ( 'Send' == button.value ) ?
'Please wait...' : 'Send';
}

function validate( form ) {
// ...
return( form.elements[ 'send' ].value != 'Send' );
}

<form ... onsubmit="return validate(this)">
<input id="send" type="submit" onclick="toggleSubmit(this)"
value="Send">
If you really want to walk down the verbose road, loop all of the form
elements and set disabled=true (warning: NOT cross-browser).
YMMV.

However, you would have to do that *after* the form was sent, otherwise
nothing would be transmitted!

[snip]

Mike
 
K

kaeli

Assuming that the delay is due to server processing and returning the
results, not sending the data, would it be feasible to return a small
intermediate page that would forward the user to the results page?

Feasible? Sure.
Worth the effort? That's very subjective, and I decided it was not. If
it were something that happened often and caused problems, I might be
more inclined, but it was only one report out of many that took so long
to run. I usually manage to make my reports run fast enough so it isn't
an issue. This was a big one requested by a user and only a few people
use it.
I might also decide it was worth if effort if it were an internet
application. Mine is intranet and I know my users.

YMMV.


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top