libs/web: annotate form object with cbi state when using section add/remove buttons
authorJo-Philipp Wich <jow@openwrt.org>
Thu, 21 Oct 2010 20:51:32 +0000 (20:51 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Thu, 21 Oct 2010 20:51:32 +0000 (20:51 +0000)
libs/web/luasrc/view/cbi/tblsection.htm
libs/web/luasrc/view/cbi/tsection.htm

index 0224610..f5e01de 100644 (file)
@@ -92,7 +92,7 @@ end
                                                        <%- end -%>
                                                        " title="<%:Edit%>"><img style="border: none" src="<%=resource%>/cbi/edit.gif" alt="<%:Edit%>" /></a>
                                                <%- end; if self.addremove then %>
-                                                       <input type="image" value="<%:Delete%>" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" />
+                                                       <input type="image" value="<%:Delete%>" onclick="this.form.cbi_state='del-section'; return true" name="cbi.rts.<%=self.config%>.<%=k%>" alt="<%:Delete%>" title="<%:Delete%>" src="<%=resource%>/cbi/remove.gif" />
                                                <%- end -%>
                                        </td>
                                <%- end -%>
@@ -122,7 +122,7 @@ end
                                <% else %>
                                        <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
                                        <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
-                                       <input class="cbi-button cbi-button-add" type="submit" value="<%:Add%>" title="<%:Add%>" />
+                                       <input class="cbi-button cbi-button-add" type="submit" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" title="<%:Add%>" />
                                        <% if self.invalid_cts then -%>
                                                <br /><%:Invalid%></div>
                                        <%- end %>
index 0fa285c..9361b6d 100644 (file)
@@ -21,7 +21,7 @@ $Id$
        <% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
                <% if self.addremove then -%>
                        <div class="cbi-section-remove right">
-                               <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" value="<%:Delete%>" />
+                               <input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" />
                        </div>
                <%- end %>
 
@@ -51,7 +51,7 @@ $Id$
                        <%- else -%>
                                <% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
                                <input type="text" class="cbi-section-create-name" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
-                               <input type="submit" class="cbi-button cbi-button-add" value="<%:Add%>" />
+                               <input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
                                <% if self.invalid_cts then -%>
                                        <br /><%:Invalid%></div>
                                <%- end %>