Forum Moderators: not2easy

Message Too Old, No Replies

DIV to block user interface

IE needs background-color

         

Robert2

9:37 am on Nov 22, 2010 (gmt 0)

10+ Year Member



Hi,
I wanted to create a DIV that would block the user from clicking on components, such as form fields.
See this example:

<html>
<head>
<title>Block Screen</title>
</head>
<body>
<input type="text" value="blocked">
<div style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%"></div>
</body>
</html>



This works fine in Firefox, however Internet Explorer 8 still allows you to edit the text field. I noticed however that the moment I specify a background-color, I cannot edit the text field anymore. I then combined this with opacity for IE like this example:

<html>
<head>
<title>Block Screen</title>
</head>
<body>
<input type="text" value="blocked">
<div style="position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; background-color: black; filter: alpha(opacity=0)"></div>
</body>
</html>


This actually works for IE. I also tried background-color: transparent, but that does not work.

Could anyone tell me why this background-color makes a difference?
And also if there is any way to do this in a simpler way for for Internet Explorer 8.

milosevic

9:51 am on Nov 22, 2010 (gmt 0)

10+ Year Member



That's really strange behaviour!

I've noticed how easily some things can become unclickable in IE with certain PNG scripts, my thoughts would be to try and set a trans PNG as the background if you want to avoid using the alpha filter, and see if that works.

For what reason do you want to do this though? That was the first question that came to my mind.

Bear in mind that advanced users would still be able use the form by disabling CSS in their browser. How apparent will it be to your users that they can't fill in the form? I've previously seen people attempting to fill in a screenshot of a form on a poorly thought out "form filling out guide" page for minutes in the past.

You realise that you can toggle form fields between being disabled and active with a couple of lines of JavaScript, right? [codetoad.com...]

This way gives a strong visual clue to your users that they can't fill in the form

Robert2

10:21 am on Nov 22, 2010 (gmt 0)

10+ Year Member



This is just a part of a shared ajax service, that uses a queue and UI blocking to make some guarantees about the asynchronous behaviour of ajax. It does not need to be fullproof. But it does work really well so far.