In addition to Hartmut's suggestion, if the field is for teacher use only you can set it to not-editable (locked) in the field's configuration. Then you do not need to pattern ! flag and only teachers will be able to edit its content. hth
Dataform (plugin)
how to present field content as read only
This discussion has been locked so you can no longer reply to it.