[luci] hack the cbi to allow custom error messages to be displayed on a form page

This commit is contained in:
Bart Van Der Meerssche 2011-04-23 00:01:42 +02:00
parent e53d1d384f
commit f55b344ec4
1 changed files with 3 additions and 7 deletions

View File

@ -1402,15 +1402,11 @@ function AbstractValue.parse(self, section, novld)
if fvalue and #fvalue > 0 then -- If we have a form value, write it to UCI if fvalue and #fvalue > 0 then -- If we have a form value, write it to UCI
fvalue = self:transform(self:validate(fvalue, section)) fvalue = self:transform(self:validate(fvalue, section))
if not fvalue and not novld then if not fvalue and not novld then
if self.error then if not self.error then
self.error[section] = "invalid"
else
self.error = { [section] = "invalid" } self.error = { [section] = "invalid" }
end end
if self.section.error then if not self.section.error then
table.insert(self.section.error[section], "invalid") self.section.error = { [section] = { "invalid" } }
else
self.section.error = {[section] = {"invalid"}}
end end
self.map.save = false self.map.save = false
end end