[luci] SimpleForm Handler and ListValue options
Paul dubliner
paul.dubliner at gmail.com
Fri Oct 9 18:40:42 CEST 2009
Hi -
Been looking at the SimpleForm and trying unsuccessfully to manipulate the
options that appear on a drop-down menu dynamically - that is, where a user
makes a choice when the webpage is returned to them the list of options in
the drop-down has been changed to show different options.
Using the SimpleForm in a Model/CBI file and not a html template as I have
other webpage elements using the UCI.
For example, a basic example, much simplified - if the user selects OFF from
the drop-down, the next time they see it , the drop-down offers ON as an
option but OFF is gone - the form handler has changed the options list.
My problem is that the options list of ListValue is rendered the one time
and does not change - do I need to bring this list inside the form handler?
How to do that?
Any help would be great!
Thanks
Paul
f = SimpleForm("my_form", "my_form")
local theoptions = f:field(ListValue, "_stuff", "Your Options")
theoptions:value("")
theoptions:value("hot","HOT")
theoptions:value("cold","COLD")
theoptions:value("off","OFF")
function f.handle(self,state.data)
....
...
if data._stuff == "OFF" then
--I want to add the option "ON" to the dropdown and remove "OFF"
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.subsignal.org/pipermail/luci/attachments/20091009/a497f459/attachment.htm
More information about the luci
mailing list