Hi,

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,

Lorenzo

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
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to