summaryrefslogtreecommitdiffstats
path: root/acf2/model/model.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acf2/model/model.lua')
-rw-r--r--acf2/model/model.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/acf2/model/model.lua b/acf2/model/model.lua
index 4b6224c..923ac05 100644
--- a/acf2/model/model.lua
+++ b/acf2/model/model.lua
@@ -189,7 +189,17 @@ function M.Model:init(context)
function mt.validate()
for _, f in ipairs(_members(Field)) do
- if f.editable then f:validate_saved() end
+ if f.editable then
+ local relevant = true
+ for k, v in pairs(f.condition or {}) do
+ if mt.load(k) ~= v then
+ relevant = false
+ break
+ end
+ end
+ if relevant then f:validate_saved()
+ else f:clear() end
+ end
end
end