Hi,
I have a form where the user input some variables.
On submit a new page opens, where I have several sql querys.
In the end of this page the results of the querys is shown in a table.
All this works very nice, however all these querys takes a few seconds.
From the moment you press the submit button, it seems like nothing is happening, like the webpage is frozen.
Is there a way to either show a wait cursor or show a animated gif?
Wait cursor
Moderator: General Moderators
Re: Wait cursor
Is there any way you can speed up the queries? Do you know why they're taking so long?
If you can't, which should be the first thing you try, there are a few options. Changing the mouse cursor is as simple as
which you can apply with a class or by setting the style directly. You should also put something more obvious on the page, like a busy indicator (spinning circles are popular these days), and you probably should also disable the form so the user cannot submit the form a second time when they get impatient.
But check the queries first.
If you can't, which should be the first thing you try, there are a few options. Changing the mouse cursor is as simple as
Code: Select all
body { cursor: wait; }But check the queries first.
-
shiningsun
- Forum Newbie
- Posts: 11
- Joined: Fri Feb 10, 2017 6:49 am
Re: Wait cursor
yes. the best way is to set changing of cursor from the moment when an event happens
it is easy can be done on jquery
it is easy can be done on jquery
Re: Wait cursor
Yes this is probably a good solution, but where do I put it?requinix wrote:Is there any way you can speed up the queries? Do you know why they're taking so long?
If you can't, which should be the first thing you try, there are a few options. Changing the mouse cursor is as simple aswhich you can apply with a class or by setting the style directly. You should also put something more obvious on the page, like a busy indicator (spinning circles are popular these days), and you probably should also disable the form so the user cannot submit the form a second time when they get impatient.Code: Select all
body { cursor: wait; }
But check the queries first.
In the page where the users data and submit button or the file containing the querys?
I tried from the first page, but nothing happened. Could be something wrong with my code..
I want the cursor to change when the submit button is pressed and change back to normal when the second page is finished loading.
Re: Wait cursor
Solved it
Heres my solution:
And this:
Heres my solution:
Code: Select all
<input type="submit" value="Show result" onclick="ChangeCursor()">
Code: Select all
<script>
function ChangeCursor(){
document.body.style.cursor = 'wait';
}
</script>