[luci] a taboption depends on a taboption belongs to other section?

Le Tran Dat trandatnh at gmail.com
Thu Nov 27 03:12:17 CET 2014


I've search the source code of LuCI and didn't find any code that use
variable from other sections.

Could anyone suggest me a way to automatically change a taboption value
depends on another taboption value of another section?

Thanks,
Dat

On Wed, Nov 26, 2014 at 6:53 PM, Le Tran Dat <trandatnh at gmail.com> wrote:

> Hi list,
>
> To set a taboption depends on antoher taboption, normally I will do like
> this
>
> s:taboption("files", Flag, "noresolv",
>     translate("Ignore resolve file")).optional = true
>
> rf = s:taboption("files", Value, "resolvfile",
>     translate("Resolve file"),
>     translate("local <abbr title=\"Domain Name System\">DNS</abbr> file"))
>
> rf:depends("noresolv", "")
> rf.optional = true
>
>
> ===================================
> However, How can I get the value of noresolv if noresolv is in different
> section?
> For example I changed noresolv to s1, and rf to s2 like this:
>
> s1:taboption("files", Flag, "noresolv",
>     translate("Ignore resolve file")).optional = true
>
> rf = s2:taboption("files", Value, "resolvfile",
>     translate("Resolve file"),
>     translate("local <abbr title=\"Domain Name System\">DNS</abbr> file"))
>
> rf:depends("noresolv", "")
> rf.optional = true
>
> Thanks,
> Dat
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsignal.org/pipermail/luci/attachments/20141127/077808e4/attachment.html>


More information about the luci mailing list