Some documents change the read only state of member fields. Okular currently does not support this and poppler does not expose setting the read only state. This makes such documents "unfillable" through Okular as fields that need to be filled are not fillable.
Here are two real world documents that do this:
And a more minimal test case that I built:
I was a bit unsure where to add the readOnly storage. It's not a widget annotation. The Adobe PDF spec 1.7 explicitly says that the ReadOnly Annotation is ignored for form fields as I understood it.
My first draft was to keep it completly internal to okular and not store the state on save (as it is calculated anyway). But this is kind of weird as we then have two read only values, one set from scripts in Okular and one from the document / poppler. So for the discussion here I'll attach a patch against poppler that exposes the fields setReadOnly. It's still not stored when the document is saved but as it's not an annotation I don't see how it should be saved. But I think exposing the poppler storage is the cleaner solution.
The result is pretty cool IMO:
It could be nicer e.g. that the changed readOnly state is rendered in the background of newly enabled checkboxes. But the documents can be used now and I think that this is a good first step for this feature.
P.S.
Sorry to mix in the Checkbox values here but having read only depend on checkbox values was in my examples and easiest for me to copy for a minimal testcase. It's also just a small additional patch.