Quirks mode revisited

Page: 1

Author Post
Member
Registered: Feb 2016
Posts: 3
My wife and I have been using floatbox for since 2011 on our electronic medical record server. The programing was done in php by my wife, who no longer administers the server. The emr pages' code hasn't been touched since she initially wrote it. In the past year, I started getting the "Floatbox does not support quirks mode. Page needs to have a valid doctype declaration." alert when I saved entries on a page.

I have replaced the doctype declaration on the index and all pages using floatbox with the simplified html declaration, <!DOCTYPE html>, without any change observed. Since the pages are php pages, the doctype declaration is NOT the first line on the page. But that's been the case for years, and floatbox has not protested until recently.

Complicating this picture is the fact that this is not consistent. There are times when my notes are recorded just fine. The only variable I can detect is whether or not something like an apostrophe is used in my notes.

Something has changed, and it's not our code. The code has worked in it's current form since floatbox version 4. I just upgraded to 6.1, thinking that must surely be the problem.

Hardware is a Mac Pro. OS is Yosemite. El Capitan renders the same results.

This is a disaster in my practice. I could use some help beyond changing the doctype declaration.

Thanks,
Larry
Administrator
Registered: Aug 2008
Posts: 3382
Hi,

It really is that simple: provide a valid HTML doctype at the beginning of the page, and all browsers will operate in standards mode. If the doctype declaration is syntactically invalid, not present, or buried somewhere down in the HTML document's markup, all browsers will operate in some form of "quirks mode". Floatbox runs only on standards mode pages, and will give the failure message if the page is being rendered in quirks mode.

Serving the pages from php is no obstacle to placing the doctype declaration at the top of the HTML that is sent to the browser. It needs to be the first thing in that HTML at the browser, and has nothing to do with the positioning in the server-side php script code that constructs and delivers that HTML markup.

I suggest viewing a page where the quirks mode message appears and selecting "view source" from the browser client you are using. You will see in that source that the first line is not <!DOCTYPE html>. Correct that problem so that the doctype is correct and present in the HTML and Floatbox will work correctly in all browsers without a "quirks mode" warning message.
Member
Registered: Feb 2016
Posts: 3
Well, maybe we're getting somewhere, because I have already done precisely that earlier this evening. I looked at the code of a failed entry from today, and this is what the top of the document looks like—nothing above the doctype declaration:

<!DOCTYPE html>
<html><!-- InstanceBegin template="/Templates/EMRtemp.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta name="copyright" content="1999-2009 Dr. Larry Horton, Future Medicine Now, Inc.">
<meta name="Author" content="Dr. Larry Horton">
<meta name="Language" content="en">
<link rel="shortcut icon" href="../Images/fmnfavicon.png" type="image/x-icon" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Continuation of Treatment :: Future Medicine Now</title>

?
Administrator
Registered: Aug 2008
Posts: 3382
I suspect that quoted source must be the form's HTML prior to the submission that generated a quirks mode response. If indeed, you submitted the form, got a quirks mode message after the submission, dismissed that message, immediately viewed source and found everything ok with the source at that point...
Well, I don't think that can happen and have never seen nor heard of it ever happening elsewhere.

So... If I am to offer anything further of value, I'll have to see the page live, get instructions on what to do, what to submit, to trigger a quirks mode warning, and dive into it with my own eyeballs and tools.
Administrator
Registered: Aug 2008
Posts: 3382
I'm not sure of your setup or how exactly your pages and workflow are structured, but if you are submitting a form from within an iframe - perhaps one shown inside a floatbox - the response to that submit will get returned to that iframe. If that response includes the floatbox.js script but does not have the valid doctype declaration, quirks mode will be triggered for that response document and the quirks mode message will be generated by that document. If would be the iframe's document source that you would want to view to see where it's breaking down, not the source of the base page that contains the iframe.
Member
Registered: Feb 2016
Posts: 3
You're correct—that was not the generated code. Here it is, down to the suspected problem in bold:

<html><head><style type="text/css"></style><style id="style-1-cropbar-clipper">/* Copyright 2014 Evernote Corporation. All rights reserved. */
.en-markup-crop-options {
top: 18px !important;
left: 50% !important;
margin-left: -100px !important;
width: 200px !important;
border: 2px rgba(255,255,255,.38) solid !important;
border-radius: 4px !important;
}

.en-markup-crop-options div div:first-of-type {
margin-left: 0px !important;
}
</style></head><body onload="self.focus();document.contTxForm.subjective.focus(); if (document.ptRecordForm.pgmMessage.value!='') {alert(document.ptRecordForm.pgmMessage.value);} "><font color="red">Error in statement: insert into continuingTreatment
(patientId,providerId,subjective,objective,tongue,pulse,
dateSeen, prescription,treatment,updateUser,changeDate,specialNotes, visitType)values(14,3,'Michael reports problems with right ischial tuberosity pain again. Says it's exacerbated by sleeping on Cynthia's futon. Much harder than the mattress at home, which has egg carton foam on top...',
'','','',
'2016-02-15','','',
'larryhorton',sysdate(),'', 5)<br>
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's exacerbated by sleeping on Cynthia's futon. Much harder than the mattress at h' at line 3<br></font>

Thanks for your help. I'll have to ask my wife about this one—I'm not a php guy.
Administrator
Registered: Aug 2008
Posts: 3382
Ah-hah!

You mentioned the problem seemed to occur when an apostrophe was submitted. It sounds like the form input is not being scrubbed and is going straight into the php processing code as whatever was typed in the form-fields. This opens your site up to SQL injection vulnerabilities and, as you have seen, unintended syntax violations.

It's a somewhat technical task to sanitize the form data as it comes in to the php back end, but really isn't too complicated or difficult.

Page: 1