libs/cbi:
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 8 Nov 2009 02:30:35 +0000 (02:30 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 8 Nov 2009 02:30:35 +0000 (02:30 +0000)
- support hidden fields for SimpleForm, NamedSection and TypedSection instances
- add support for on_cancel event in SimpleForm instances

libs/cbi/luasrc/view/cbi/nullsection.htm
libs/cbi/luasrc/view/cbi/simpleform.htm
libs/cbi/luasrc/view/cbi/ucisection.htm

index 9520b47cabb155da6f2b682802e744741dbac7ae..f1c715b40818ea5c4981b597e0ffad2d9dc7b086 100644 (file)
@@ -20,4 +20,13 @@ $Id$
                                <% self:render_children(1, scope or {}) %>
                        </div>
                        <br />
-               </fieldset>
\ No newline at end of file
+               </fieldset>
+               <%-
+                       if type(self.hidden) == "table" then
+                               for k, v in pairs(self.hidden) do
+               -%>
+                       <input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
+               <%-
+                               end
+                       end
+               %>
index d927660da4d8cfa4106bcf0d0379223f5800c351..a0bb0f02b5333fbe3ae578076f4f8179cf47c414 100644 (file)
@@ -33,17 +33,31 @@ $Id$
 <%- end %>     
 <% if not self.embedded then %>
        <div>
+<%-
+       if type(self.hidden) == "table" then
+               for k, v in pairs(self.hidden) do
+-%>
+       <input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
+<%-
+               end
+       end
+%>
 <%- if self.flow and self.flow.skip then %>
        <input class="cbi-button cbi-button-skip" type="submit" name="cbi.skip" value="<%:Skip%>" />
 <% end %>
 <%- if self.submit ~= false then %>
-               <input class="cbi-button-save" type="submit" value="
-       <%- if not self.submit then -%><%-:submit-%><%-else-%><%=self.submit%><%end-%>
+       <input class="cbi-button-save" type="submit" value="
+               <%- if not self.submit then -%><%-:Submit-%><%-else-%><%=self.submit%><%end-%>
        " />
 <% end %>
 <%- if self.reset ~= false then %>
-               <input class="cbi-button-reset" type="reset" value="
-       <%- if not self.reset then -%><%-:reset-%><%-else-%><%=self.reset%><%end-%>
+       <input class="cbi-button-reset" type="reset" value="
+               <%- if not self.reset then -%><%-:Reset-%><%-else-%><%=self.reset%><%end-%>
+       " />
+<% end %>
+<%- if self.cancel ~= false and self.on_cancel then %>
+       <input class="cbi-button-reset" type="submit" name="cbi.cancel" value="
+               <%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
        " />
 <% end %>
                <script type="text/javascript">cbi_d_update();</script>
index fa083c68f437e66e72a19e3fa57027be3fff4c69..b184908b0b8f1f8ea9d928862f15333b974d6635 100644 (file)
@@ -17,7 +17,7 @@ $Id$
        if type(self.hidden) == "table" then
                for k, v in pairs(self.hidden) do
 -%>
-       <input type="hidden" id="cbid.<%=self.config%>.<%=section%>.<%=k%>" name="cbid.<%=self.config%>.<%=section%>.<%=k%>" value="<%=pcdata(v)%>" />
+       <input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
 <%-
                end
        end