valid = valid
and (not v.tag_missing or not v.tag_missing[1])
and (not v.tag_invalid or not v.tag_invalid[1])
+ and (not v.error)
end
end
for i, k in ipairs(self:cfgsections()) do
AbstractSection.parse_dynamic(self, k)
if self.map:submitstate() then
- Node.parse(self, k)
+ Node.parse(self, k, novld)
if not novld and not self.override_scheme and self.map.scheme then
_uvl_validate_section(self, k)
--self.cast = "string"
self.track_missing = false
- --self.rmempty = false
+ self.rmempty = true
self.default = nil
self.size = nil
self.optional = false
if not self.override_scheme
and self.map:get_scheme(self.section.sectiontype, self.option) then
local vs = self.map:get_scheme(self.section.sectiontype, self.option)
- if self.rmempty == nil then
- self.rmempty = not vs.required
- end
if self.cast == nil then
self.cast = (vs.type == "list") and "list" or "string"
end
self.rmempty = not value
end
-function AbstractValue.parse(self, section)
+function AbstractValue.parse(self, section, novld)
local fvalue = self:formvalue(section)
local cvalue = self:cfgvalue(section)
if fvalue and #fvalue > 0 then -- If we have a form value, write it to UCI
fvalue = self:transform(self:validate(fvalue, section))
- if not fvalue then
- self.tag_invalid[section] = true
+ if not fvalue and not novld then
+ if self.error then
+ self.error[section] = "invalid"
+ else
+ self.error = { [section] = "invalid" }
+ end
+ self.map.save = false
end
if fvalue and not (fvalue == cvalue) then
if self:write(section, fvalue) then
self.section.changed = true
--luci.util.append(self.map.events, self.events)
end
- elseif self.track_missing and (not fvalue or fvalue ~= cvalue) then
- self.tag_missing[section] = true
+ elseif cvalue ~= fvalue and not novld then
+ self:write(section, fvalue or "")
+ if self.error then
+ self.error[section] = "missing"
+ else
+ self.error = { [section] = "missing" }
+ end
+ self.map.save = false
end
end
end