Allow subsequent changes of Table data
+Form = class(SimpleForm)
+
+function Form.__init__(self, ...)
+ SimpleForm.__init__(self, ...)
+ self.embedded = true
+end
+
function Table.__init__(self, form, data, ...)
local datasource = {}
function Table.__init__(self, form, data, ...)
local datasource = {}
datasource.config = "table"
datasource.config = "table"
datasource.formvalue = Map.formvalue
datasource.formvaluetable = Map.formvaluetable
datasource.readinput = true
function datasource.get(self, section, option)
datasource.formvalue = Map.formvalue
datasource.formvaluetable = Map.formvaluetable
datasource.readinput = true
function datasource.get(self, section, option)
- return data[section] and data[section][option]
+ return tself.data[section] and tself.data[section][option]
end
function datasource.submitstate(self)
end
function datasource.submitstate(self)
+function Table.update(self, data)
+ self.data = data
+end
+
+<% if not self.embedded then %>
<form method="post" action="<%=REQUEST_URI%>">
<div>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<input type="hidden" name="cbi.submit" value="1" />
</div>
<form method="post" action="<%=REQUEST_URI%>">
<div>
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
<input type="hidden" name="cbi.submit" value="1" />
</div>
<div class="cbi-map" id="cbi-<%=self.config%>">
<h2><a id="content" name="content"><%=self.title%></a></h2>
<div class="cbi-map-descr"><%=self.description%></div>
<div class="cbi-map" id="cbi-<%=self.config%>">
<h2><a id="content" name="content"><%=self.title%></a></h2>
<div class="cbi-map-descr"><%=self.description%></div>
<%- if self.errmessage then %>
<div class="error"><%=self.errmessage%></div>
<%- end %>
<%- if self.errmessage then %>
<div class="error"><%=self.errmessage%></div>
<%- end %>
+<% if not self.embedded then %>
<div>
<%- if self.submit ~= false then %>
<input class="cbi-button-save" type="submit" value="
<div>
<%- if self.submit ~= false then %>
<input class="cbi-button-save" type="submit" value="
<script type="text/javascript">cbi_d_update();</script>
</div>
</form>
<script type="text/javascript">cbi_d_update();</script>
</div>
</form>