[luci] about rmempty
Christian Schoenebeck
christian.schoenebeck at gmail.com
Wed Dec 17 09:59:31 CET 2014
Am 17.12.2014 um 06:41 schrieb ZDC 3305 zsv(赵松):
> Hi
>
>
>
> The rmempty default value is true? How to set to false?
>
>
>
> I want to modify the default value, because of I don’t hope luci delete the config file option when set text value to blank, is there any other idea without “rmempty”?
>
>
>
> _______________________________________________
> luci mailing list
> luci at lists.subsignal.org
> https://lists.subsignal.org/mailman/listinfo/luci
>
Hi,
inside value definition set 'rmempty = false'
<SNIP>
local ena = ns:option(Flag, "_enabled")
ena.title = translate("Enabled")
ena.description = translate("Enable/Disable autostart of Privoxy on system startup and interface events")
ena.orientation = "horizontal" -- put description under the checkbox
ena.rmempty = false
</SNIP>
other option is to modify the .write function to your needs (here I enable/disable autostart of privoxy service)
<SNIP>
function ena.write(self, section, value)
if value == "1" then
return luci.sys.init.enable("privoxy")
else
return luci.sys.init.disable("privoxy")
end
end
</SNIP>
Have a look into feeds/luci/applications directory. There are a lot of samples who to use .write and other functions defined inside CBI for various value types
More information about the luci
mailing list