summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-09-04 09:55:46 +0000
committerSteven Barth <steven@midlink.org>2008-09-04 09:55:46 +0000
commit1f2289b41ed0d1d97e583a7e2931b1b37eb5d757 (patch)
tree3bea10e1cb609695be39eefa21a1c4d7cc6f41bd
parentccc02d41885eb6aa7cf1749432843078b2c08fb2 (diff)
libs/cbi: Use a Combobox for optional values if a section is dynamic and has defined optional fields
-rw-r--r--libs/cbi/luasrc/view/cbi/ucisection.htm15
1 files changed, 14 insertions, 1 deletions
diff --git a/libs/cbi/luasrc/view/cbi/ucisection.htm b/libs/cbi/luasrc/view/cbi/ucisection.htm
index e129c9526e..e571cb212e 100644
--- a/libs/cbi/luasrc/view/cbi/ucisection.htm
+++ b/libs/cbi/luasrc/view/cbi/ucisection.htm
@@ -26,7 +26,20 @@ $Id$
<% if self.optionals[section] and #self.optionals[section] > 0 or self.dynamic then %>
<div class="cbi-optionals">
<% if self.dynamic then %>
- <input type="text" name="cbi.opt.<%=self.config%>.<%=section%>" />
+ <input type="text" id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>" />
+ <% if self.optionals[section] and #self.optionals[section] > 0 then %>
+ <script type="text/javascript">
+ cbi_combobox_init('cbi.opt.<%=self.config%>.<%=section%>', {
+ <%-
+ for i, val in pairs(self.optionals[section]) do
+ -%>
+ <%-=string.format("%q", striptags(val.title)) .. ":" .. string.format("%q", val.option)-%>,
+ <%-
+ end
+ -%>
+ }, '', '<%-:cbi_manual-%>');
+ </script>
+ <% end %>
<% else %>
<select name="cbi.opt.<%=self.config%>.<%=section%>">
<option><%:cbi_addopt%></option>