Gossamer Forum
Home : Products : DBMan : Customization :

want hourglass or spinner while waiting

Quote Reply
want hourglass or spinner while waiting
typical dbman setup is a form sub, followed by a sub to perform an action, which is followed by either return to form sub with error message or a sub that displays success page. i want to display an hourglass or spinner when the user clicks the submit button. then get rid of the spinner and display the normal error or success page upon completion of action. how can i do this?
Quote Reply
Re: [delicia] want hourglass or spinner while waiting In reply to
Hi,

Sorry, I don't know much about DBMan. The issue with those kinds of things, is that normally they work via AJAX. My best guess, would be:

1) grab an image from http://www.ajaxload.info/
2) On your template, you want a new bit of HTML before the </body>

Code:
<div id="loader_wrapper">
<div id="loader_inner">
<img src="/url/to/loader.gif">
</div>
</div>

3) You then need some CSS on your page.:

Code:
#ajax_loading_wrapper{
display:none;
width:100%;
height:100%;
top:0;
left:0;
position:fixed;
background:rgba(233,233,233,0.7);
z-index:100000
}

#ajax-loader-spinner {
width:60px;
height:60px;
top:50%;
left:50%;
position:fixed;
margin-top:-30px;
margin-left:-30px
}

You will want to play with the margin-left/top sizes, as well as the width/height of the spinner div. They want to be 50% of the value. So if your width if 100px,. it would be -50px.

4) The final step is to add something onto your <form>:

Code:
<form ... onsubmit='document.getElementById("loader_wrapper").style.display = "block"'>

(... is all your normal code for the form as well)

This should then trigger when you submit the form. It would then show the loading div, and obviously hide it again once the form reloads (if there are errors)

Hope that helps

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!