I need to Only ever update uci config file if the field has passed validation on Edit .
suppose current config file -
config redirect
option a 123
option b 456
Code-
m = Map("abc",translate("SETTINGS"),translate(""))
s = m:section(NamedSection, section, "redirect", "")
o = s:option(Value, "a", translate("a name"),translate(""))
o = s:option(Value, "b", translate("b name"),translate(""))
--validation for do not accept balnk "a" if "b" is specified.
function o.validate(self, value, section)
local a = self.map:get(section, "a")
if value and a == nil then
return nil, translate("a field value is missing")
end
return value
end
So on Edit scenario when there is an error blank value for "a" is getting saved in config file.
I don't want to update config value if there is an error occurred.
So how can i prevent to update fields ?
Any suggestions would be appreciated.