Can we add new entry to uci file based on selected options

Intention is to write option "efilter1" and "efilter2" to "1" in the UCI file when "testFlag" is enabled. These options need not be displayed in LuCI web interface.

s:taboption("general", Flag, "testFlag", translate("Ignore Option"))

efilter1 = s:taboption("general",DummyValue, "filter1")
efilter1:depends("testFlag", "0")
efilter1.value= "1"

efilter2 = s:taboption("general",DummyValue, "filter2")
efilter2:depends("testFlag", "0")
efilter2.value= "1"

When this was tried, nothing was written to the UCI config.

Is there a way to get this done or not a valid scenario? Should all data that will be written to the UCI config file must be represented in UI?

o = s:taboption("general", Flag, "testFlag", translate("Ignore Option"))
o.write = function(self, section_id, value)
    self.map:set(section_id, "efilter1", "1")
    self.map:set(section_id, "efilter2", "1")
end

o.remove = function(self, section_id)
    self.map:delete(section_id, "efilter1")
    self.map:delete(section_id, "efilter2")
end

Am able to write to the UCI file, but while removing - an error "attempt to call method 'delete' (a nil value)" shows up.

May fault, it must be self.map:del(...) not self.map:delete(...)

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.