[LuCI] How to read a"Flag" option but keep it hidden from the user, just for other options to have a dependency on it?

Not sure where to post a question about LuCI syntax on building a new module. Is this the correct place?

Thanks!

@frares, welcome to the community!

(Moved to the For Developers section.)

  • Can you better describe what UCI syntax you're interested in learning about?
  • What will the module do?

The code can be referenced too. Also see: https://openwrt.org/docs/techref/uci

Thanks, lleachii.

It's a voip service. I've planned to have a "Basic" and "Advanced" configuration pages, all reading the same config file. Those models are almost finished except for one detail: there's a boolean (Flag) "option" treated in the "Basic" page that some of the options in the "Advanced" page needs dependency to be shown or not.

So, how do I read an option so that other ones may check to see if they will appear or not?

Trying to be clearer:

On the first model, the "Basic" page, there is the "use_proxy" flag:

use_proxy = s:option(Flag, "use_proxy", translate("Enable use of SIP Proxy"))
use_proxy.rmempty = false

On the second, the "Advanced" page, there are some "options" that need to know the status of the "use_proxy" flag, for instance:

o = s:taboption("sip_settings", Value, "proxy_gateway_name", translate("Proxy Gateway Name"))
o.datatype = "hostname"
o:depends("use_proxy", '1')

This is, of course, incomplete, as there is no - yet - "use_proxy" available.

I could double the same option from the first to the second model, but as it is already treated in the "Basic" one, I wouldn't like to do this again in the second.

So, my doubt is which entity shall I create so that to put the contents of m.uci:get("voip", section, "use_proxy") - or something like this - without allowing the user to change the option that is already treated in the first "Basic" model.

Thanks!

Perhaps I've added too much constraints...

What I want is to read a configuration in an "Advanced" item which is configured in a "Basic" model so that some "option" and/or "taboption" might be aware of in a dependency relation, so that the "Flag" item set up in that "Basic" module may affect items in the "Advanced" module.

The best I could do was to assign the same parameter in the "Advanced" module as a "DummyValue" without any label, but it still appears a single "1" in the rendered web page when that "Flag" is true.

Thanks!
Francisco

@frares Hello, finally, have you found the solution? I'm interested. Thanks