Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luci-compat: CBI skip fields that do not satisfy depends #7463

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion modules/luci-compat/luasrc/cbi.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ function AbstractValue.parse(self, section, novld)
--luci.util.append(self.map.events, self.events)
end
end
elseif cvalue ~= fvalue and not novld then
elseif (fvalue ~= nil or self.nilasempty) and cvalue ~= fvalue and not novld then
-- trigger validator with nil value to get custom user error msg.
local _, val_err = self:validate(nil, section)
self:add_error(section, "missing", val_err)
Expand Down Expand Up @@ -1695,6 +1695,7 @@ function MultiValue.__init__(self, ...)

self.widget = "checkbox"
self.delimiter = " "
self.nilasempty = true

self:reset_values()
end
Expand Down Expand Up @@ -1785,6 +1786,7 @@ function DynamicList.__init__(self, ...)
AbstractValue.__init__(self, ...)
self.template = "cbi/dynlist"
self.cast = "table"
self.nilasempty = true
self:reset_values()
end

Expand Down
Loading