diff --git a/include/class.dynamic_forms.php b/include/class.dynamic_forms.php
index 8bb94d81c792c4c407b6b0801de9a44f7dbae4a4..7b610318a0c6e4bcd8bcce075b0ea8d86e3880aa 100644
--- a/include/class.dynamic_forms.php
+++ b/include/class.dynamic_forms.php
@@ -874,12 +874,15 @@ class DynamicFormField extends VerySimpleModel {
         if (!$this->get('label'))
             $this->addError(
                 __("Label is required for custom form fields"), "label");
-        if ($this->get('required') && !$this->get('name'))
+        if (($this->isRequiredForStaff() || $this->isRequiredForUsers())
+            && !$this->get('name')
+        ) {
             $this->addError(
                 __("Variable name is required for required fields"
                 /* `required` is a visibility setting fields */
                 /* `variable` is used for automation. Internally it's called `name` */
                 ), "name");
+        }
         if (preg_match('/[.{}\'"`; ]/u', $this->get('name')))
             $this->addError(__(
                 'Invalid character in variable name. Please use letters and numbers only.'
diff --git a/include/class.forms.php b/include/class.forms.php
index 73e89287bab0c1529558fdbe59fc3977ace94105..9f4ece823e177d93a81a0df42d2a2f97923edc12 100644
--- a/include/class.forms.php
+++ b/include/class.forms.php
@@ -498,7 +498,7 @@ class FormField {
      */
 
     function isEditable() {
-        return (($this->get('edit_mask') & 32) == 0);
+        return (($this->get('flags') & DynamicFormField::FLAG_MASK_EDIT) == 0);
     }
 
     /**