Jump to content

Disabling form and loading in screen


Pezmc

Recommended Posts

I have just created a digital questionnaire for some year 7's at my school. However the school server is quite slow and the pages take quite a long time to load. Many of the year 7's click the submit button multiple times and wreck the database.

Recently I saw on a website a form that when you submitted it, it filled the screen with 50% opaque black. And in the middle it said loading..., how does this work, does anyone have the script, does anyone have a better solution?

Thanks in advance

Link to comment
Share on other sites

presumably that would be a hidden div containing some sort semi transparent gif which is displayed using the onSubmit handler?

 

Personally I find it easier to have the onSubmit handler call a function which disables the button (or the fields as well if you wish)

document.formname.buttonname.disabled = true

Link to comment
Share on other sites

that technology is similiar to lightbox.js which is free and is currently being used even by ebay to show pop up full size pictures.  I haven't tried it but it's reputed to be highly cross browser compatable.  You could download it and try modifying it for your needs. 

 

For a simpler solution, you can do this:

document.body.style.backgroundColor = "#cccccc";

That changes the background color of the whole document to gray.  You can then put a div at the end of your code(must be at the end) and set it with "position:absolute; top: ???; left:???; display:none;background-color:white;".  Put your message in the div and when the form is submitted do this:

document.body.style.backgroundColor = "#cccccc";
document.getElementById('messagedivID').style.display = 'block';

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.