summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-11-08 02:30:35 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-11-08 02:30:35 +0000
commit6ba1aef019e891bf10bd4bdcb34cd61cf813f881 (patch)
tree89932c95e818ec12ef2920a8ada6352c2654f819
parentdc93bf1fcc3f64a0ab653c7c4904fe739c9e25b6 (diff)
libs/cbi:
- support hidden fields for SimpleForm, NamedSection and TypedSection instances - add support for on_cancel event in SimpleForm instances
-rw-r--r--libs/cbi/luasrc/view/cbi/nullsection.htm11
-rw-r--r--libs/cbi/luasrc/view/cbi/simpleform.htm22
-rw-r--r--libs/cbi/luasrc/view/cbi/ucisection.htm2
3 files changed, 29 insertions, 6 deletions
diff --git a/libs/cbi/luasrc/view/cbi/nullsection.htm b/libs/cbi/luasrc/view/cbi/nullsection.htm
index 9520b47ca..f1c715b40 100644
--- a/libs/cbi/luasrc/view/cbi/nullsection.htm
+++ b/libs/cbi/luasrc/view/cbi/nullsection.htm
@@ -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
+ %>
diff --git a/libs/cbi/luasrc/view/cbi/simpleform.htm b/libs/cbi/luasrc/view/cbi/simpleform.htm
index d927660da..a0bb0f02b 100644
--- a/libs/cbi/luasrc/view/cbi/simpleform.htm
+++ b/libs/cbi/luasrc/view/cbi/simpleform.htm
@@ -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>
diff --git a/libs/cbi/luasrc/view/cbi/ucisection.htm b/libs/cbi/luasrc/view/cbi/ucisection.htm
index fa083c68f..b184908b0 100644
--- a/libs/cbi/luasrc/view/cbi/ucisection.htm
+++ b/libs/cbi/luasrc/view/cbi/ucisection.htm
@@ -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