1559: Add form unload protection

I'm just scribbling a dirty flag on document, which is non-ideal but easy. Passing it back up to the app level via React mechanisms was being tricky.