I want to validate the ssid . Because if ssid is void , the wifi will get down. I want to restrain it for not void. If it is void then I get value from UCI config file. So I wrote code in wifi.lua as follows:
function ssid.write(self,section)
local val = m:formvalue(self:cbid(section))
if #val < 1 then
val = self:cfgvalue(section)
m.uci:set("wireless",section,"ssid",val)
end
end
It doesn't work. Why?
The web data will be parsed in http.lua , then will be written to uci file. But if I add some rules to data (which will be written to uci file) in /model/cbi/*.lua then the data written to uci file will just follow my rules. So I get the data from the web using formvalue() then add some rules , write to uci file at last. But when the ssid is void , the wifi will still get down. And my rules just does nothing.
Why? Some wrong with my understanding with the process?
(Last edited by Wandy on 17 Oct 2014, 10:17)