Hi Folks!
I've defined a custom Luci field similar to https://github.com/seamustuohy/luci_tut … tom-fields, and want to validate it. In order to simplify this post, I've rewrite the code like this:
-- time
source_time = s:taboption("tab_source", Value, "source_time", translate("Time") )
source_time.template = "ePLAYER1/cbi_timeval"
source_time.formvalue = function (self, section)
local hour = self.map:formvalue(self:cbid(section) .. ".hour")
local min = self.map:formvalue(self:cbid(section) .. ".min")
if hour and min and #hour > 0 and #min > 0 then
return hour .. ":" .. min
else
return nil
end
end
function source_time.validate(self, value)
return nil -- always trows an error
end
Unluckily the field is always valid. Never shows up any error on the form, at least graphically.
Some clue, please? What willl be the best approach in order to validate a Luci custom field?