Attached is a patch to add a small function to z3c.multiform. The function is called 'hasChildrenAndAllSubFormsDisplayMode' and is useful as a condition for an action.

The use case is this: There is a 'remove' button that deletes lines from a multiform form. I don't want this button to show in my form unless the container has children.

I hope is useful enough to get in.

Best Regards,


Index: multiform/multiform.py
--- multiform/multiform.py      (revisión: 69197)
+++ multiform/multiform.py      (copia de trabajo)
@@ -34,6 +34,10 @@
             return False
     return True
+def hasChildrenAndAllSubFormsDisplayMode(form, action):
+    if len(form.context) == 0:
+        return False
+    return allSubFormsDisplayMode(form, action)
 class ItemAction(form.Action):
Zope3-users mailing list

Reply via email to