Print page displays unchanged checkbox in IE with DocType

A strange problem. I have a simple web form where users can fill out text and check some checkboxes. When it prints in pdf or paper (or preview) format in IE (7 or 8), these flags are printed unchanged. For example. the user sets the check, it is printed unverified ... or with a pre-set field with the user disabled, prints.

The same goes for the radio.

Only when I completely remove DocType does IE print it correctly. But I need to use XHTML-strict.

This is a simple example that does not work in IE:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="nl" xml:lang="nl-NL"> <body> <input type='checkbox' name='y'/><br/> <input type='radio' name='x'/><br/> </body> </html> 

Does not work with any type of doctype being tested (free or html4).

Does anyone know how to solve this?

Thank you very much michael

+7
checkbox internet-explorer printing
source share
1 answer

Turns out this is an IE8 bug: http://webbugtrack.blogspot.com/2009/04/bug-444-ie8-printing-issues-in.html

He did not have a problem with the Compatibility view.

The solution is to add the following to the header:

 <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 

Which view interrupts the check and gives a problem when IE9 appears.

Another β€œnice” workaround with JavaScript also works:

 <input type='checkbox' name='y' onclick='SetCheck(this)'/> ..... function SetCheck(el) { if(el) { if(el.checked) el.setAttribute('checked','checked'); else el.removeAttribute("checked"); } } 

But if you cannot rely on javascript enabled, you end up with Microsoft.

+5
source share

All Articles