-%>
+<%-
+ if type(self.hidden) == "table" then
+ for k, v in pairs(self.hidden) do
+-%>
+ <input type="hidden" name="cbid.<%=self.config%>.<%=section%>.<%=k%>" value="<%=luci.util.pcdata(v)%>" />
+<%-
+ end
+ end
+%>
+
<% self:render_children(section, scope or {}) %>
-<% if #self.optionals[section] > 0 or self.dynamic then %>
+<% if self.error and self.error[section] then -%>
+ <div class="cbi-section-error">
+ <ul><% for _, e in ipairs(self.error[section]) do %><li><%=luci.util.pcdata(e):gsub("\n","<br />")%></li><% end %></ul>
+ </div>
+<%- end %>
+
+<% 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", val.option) .. ":" .. string.format("%q", striptags(val.title))-%>
+ <%-if next(self.optionals[section], i) then-%>,<%-end-%>
+ <%-
+ end
+ -%>
+ }, '', '<%-:cbi_manual-%>');
+ </script>
+ <% end %>
<% else %>
- <select name="cbi.opt.<%=self.config%>.<%=section%>">
+ <select id="cbi.opt.<%=self.config%>.<%=section%>" name="cbi.opt.<%=self.config%>.<%=section%>">
<option><%:cbi_addopt%></option>
<% for key, val in pairs(self.optionals[section]) do -%>
- <option id="cbi-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=val.title%></option>
+ <option id="cbi-<%=self.config.."-"..section.."-"..val.option%>" value="<%=val.option%>"><%=striptags(val.title)%></option>
<%- end %>
</select>
<script type="text/javascript"><% for key, val in pairs(self.optionals[section]) do %>
<%-
for k,v in pairs(d.deps) do
-%>
- <%-=string.format('"cbid.%s.%s.%s"', self.config, section, k) .. ":" .. string.format("%q", v)-%>,
+ <%-=string.format('"cbid.%s.%s.%s"', self.config, section, k) .. ":" .. string.format("%q", v)-%>
+ <%-if next(d.deps, k) then-%>,<%-end-%>
<%-
end
-%>