diff --git a/core/misc/states.js b/core/misc/states.js
index 3c17efc..70a6c24 100644
--- a/core/misc/states.js
+++ b/core/misc/states.js
@@ -429,6 +429,12 @@ states.State = function(state) {
       this.name = this.name.substring(1);
       this.invert = !this.invert;
     }
+  });
+
+  $(document).bind('state:readonly', function(e) {
+    if (e.trigger) {
+      $(e.target).attr('readonly', e.value);
+    }
 
     // Replace the state with its normalized name.
     if (this.name in states.State.aliases) {
