[luci] Dependencies and ListValue

Conor O'Gorman i at conorogorman.net
Thu Jul 5 11:14:49 CEST 2012


On Wed, 2012-07-04 at 19:29 +0100, Christian Gagneraud wrote:
> Hi there,
> 
> I'm trying to have a ListValue whose values presence within the list 
> depends on another option (a ListValue as well).
> 
> So this is how I'm doing:
> tmp1 = section:option(ListValue, "tmp1" , translate("TMP1"))
> tmp1:value("", translate("-- Please select --"))
> tmp1:value("one", "One")
> tmp1:value("two", "Two")
> 
> tmp2 = section:option(ListValue, "tmp2" , translate("TMP2"))
> tmp2.override_depends=true -- This doesn't help!
> tmp2:value("test1", "Test1", {tmp1="one"}, {tmp1="two"})
> tmp2:value("test2", "Test2", {tmp1="one"})
> 
> And I would like to have no choice for tmp2 when tmp1="", 2 choices when 
> tmp="one" and one choice when tmp1="two"
> 

I put that code into a model and it worked for me, using the bootstrap
theme. But when I tried on the standard openwrt theme, the page gave an
error. The code to implement the dependencies is in full_valuefooter.htm
which uses deps and subdeps.

Conor




More information about the luci mailing list