From e3d6a5f1a318da26e2a8beacbe5c236c51f74694 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 25 Aug 2008 12:00:55 +0000
Subject: [PATCH] In the case of MultiLinkField, we don't want to add an empty
 <a> element.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23141 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Form/FormulatorPatch.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/product/ERP5Form/FormulatorPatch.py b/product/ERP5Form/FormulatorPatch.py
index 4f60c071fe..1973844bed 100644
--- a/product/ERP5Form/FormulatorPatch.py
+++ b/product/ERP5Form/FormulatorPatch.py
@@ -31,6 +31,7 @@ from Products.Formulator.Widget import ListWidget
 from Products.Formulator.Widget import RadioWidget
 from Products.Formulator.Widget import MultiItemsWidget
 from ProxyField import ProxyField
+from MultiLinkField import MultiLinkFieldWidget
 from AccessControl import ClassSecurityInfo
 from DocumentTemplate.ustr import ustr
 from cgi import escape
@@ -714,9 +715,12 @@ def MultiItemsWidget_render_items(self, field, key, value, REQUEST, render_prefi
 
   items = field.get_value('items',REQUEST=REQUEST, cell=getattr(REQUEST,'cell',None)) # Added request
   if not items:
-    # multi items widget should have at least one child in order to produce
-    # valid XHTML; disable it so user can not select it
-    return [self.render_item('', '', '', '', 'disabled="disabled"')]
+    if not isinstance(self, MultiLinkFieldWidget):
+      # multi items widget should have at least one child in order to produce
+      # valid XHTML; disable it so user can not select it.
+      # This cannot be applied to MultiLinkFields, which are just some <a>
+      # links
+      return [self.render_item('', '', '', '', 'disabled="disabled"')]
 
   css_class = field.get_value('css_class')
   extra_item = field.get_value('extra_item')
-- 
2.30.9