Common subdirectories: Formulator/dtml and Formulator.jp/dtml
diff -u Formulator/Field.py Formulator.jp/Field.py
--- Formulator/Field.py	2002-03-05 19:17:13.000000000 +0100
+++ Formulator.jp/Field.py	2003-02-23 10:55:12.000000000 +0100
@@ -123,7 +123,7 @@
     def get_tales(self, id):
         """Get tales expression method for id."""
         return self.tales.get(id, "")
-    
+
     security.declareProtected('Access contents information', 'is_required')
     def is_required(self):
         """Check whether this field is required (utility function)
@@ -145,7 +145,7 @@
                 return getattr(self.validator, name)
             else:
                 return "Unknown error: %s" % name
-    
+
     security.declarePrivate('_render_helper')
     def _render_helper(self, key, value, REQUEST):
         value = self._get_default(key, value, REQUEST)
@@ -164,7 +164,7 @@
             return self.get_value('default')
 
     security.declareProtected('View', 'render')
-    def render(self, value=None, REQUEST=None):
+    def render(self, value=None, REQUEST=None, key=None):
         """Render the field widget.
         value -- the value the field should have (for instance
                  from validation).
@@ -174,7 +174,10 @@
         if value and REQUEST are both None, the 'default' property of
         the field will be used for the value.
         """
-        return self._render_helper('field_%s' % self.id, value, REQUEST)
+        # Patched by JPS for ERP5 in order to
+        # dynamically change the name
+        if key is None: key = self.id
+        return self._render_helper('field_%s' % key, value, REQUEST)
 
     security.declareProtected('View', 'render_from_request')
     def render_from_request(self, REQUEST):
@@ -182,7 +185,7 @@
         (unvalidated data), or default if no raw data is found.
         """
         return self._render_helper('field_%s' % self.id, None, REQUEST)
-    
+
     security.declareProtected('View', 'render_sub_field')
     def render_sub_field(self, id, value=None, REQUEST=None):
         """Render a sub field, as part of complete rendering of widget in
Common subdirectories: Formulator/help and Formulator.jp/help
Common subdirectories: Formulator/tests and Formulator.jp/tests
diff -u Formulator/Validator.py Formulator.jp/Validator.py
--- Formulator/Validator.py	2002-11-26 13:50:09.000000000 +0100
+++ Formulator.jp/Validator.py	2003-03-24 14:47:10.000000000 +0100
@@ -31,10 +31,10 @@
     
     def raise_error(self, error_key, field):
         raise ValidationError(error_key, field)
-    
-    def validate(self, field, key, REQUEST):    
+
+    def validate(self, field, key, REQUEST):
         pass # override in subclass
-    
+
 class StringBaseValidator(Validator):
     """Simple string validator.
     """
@@ -48,15 +48,18 @@
                                     default=1)
 
     message_names = Validator.message_names + ['required_not_found']
-    
+
     required_not_found = 'Input is required but no input given.'
-        
+
     def validate(self, field, key, REQUEST):
-        value = string.strip(REQUEST.get(key, ""))
+        # We had to add this patch for hidden fields of type "list"
+        value = REQUEST.get(key, "")
+        if type(value) is type('a'):
+          value = string.strip(value)
         if field.get_value('required') and value == "":
             self.raise_error('required_not_found', field)
         return value
-    
+
 class StringValidator(StringBaseValidator):
     property_names = StringBaseValidator.property_names +\
                      ['max_length', 'truncate']
@@ -259,16 +262,19 @@
         "If set to 0 or is left empty, there is no maximum."),
                                      default="",
                                      required=0)
-    
+
     message_names = StringBaseValidator.message_names +\
                     ['too_many_lines', 'line_too_long', 'too_long']
 
     too_many_lines = 'You entered too many lines.'
     line_too_long = 'A line was too long.'
     too_long = 'You entered too many characters.'
-    
+
     def validate(self, field, key, REQUEST):
         value = StringBaseValidator.validate(self, field, key, REQUEST)
+        # Added as a patch for hidden values
+        if type(value) is type([]) or type(value) is type(()):
+          value = string.join(value, "\n")
         # we need to add this check again
         if value == "" and not field.get_value('required'):
             return []
@@ -337,10 +343,10 @@
             # will remain integers.
             if str(item_value) == value:
                 return item_value
-            
+
         # if we didn't find the value, return error
         self.raise_error('unknown_selection', field)
-            
+
 SelectionValidatorInstance = SelectionValidator()
 
 class MultiSelectionValidator(Validator):
@@ -355,10 +361,10 @@
 
     message_names = Validator.message_names + ['required_not_found',
                                                'unknown_selection']
-    
+
     required_not_found = 'Input is required but no input given.'
     unknown_selection = 'You selected an item that was not in the list.'
-    
+
     def validate(self, field, key, REQUEST):
         values = REQUEST.get(key, [])
         # NOTE: a hack to deal with single item selections
@@ -372,7 +378,7 @@
                 self.raise_error('required_not_found', field)
             else:
                 return values
-            
+
         # create a dictionary of possible values
         value_dict = {}
         for item in field.get_value('items'):
diff -u Formulator/Widget.py Formulator.jp/Widget.py
--- Formulator/Widget.py	2002-10-24 12:35:07.000000000 +0200
+++ Formulator.jp/Widget.py	2003-03-24 14:33:42.000000000 +0100
@@ -67,7 +67,7 @@
         "to add an onClick attribute to use with JavaScript, for instance."),
                                default="",
                                required=0)
-      
+
     def render(self, field, key, value, REQUEST):
         """Renders this widget as HTML using property values in field.
         """
@@ -79,14 +79,26 @@
         try:
             extra = field.get_value('extra')
         except KeyError:
-    # In case extra is not defined as in DateTimeWidget
+        # In case extra is not defined as in DateTimeWidget
             extra = ''
-        return render_element("input",
+        result = ''
+        # We must adapt the rendering to the type of the value
+        # in order to get the correct type back
+        if type(value) is type([]) or type(value) is type(()):
+          for v in value:
+            result += render_element("input",
+                              type="hidden",
+                              name="%s:list" % key,
+                              value=v,
+                              extra=extra)
+        else:
+          result = render_element("input",
                               type="hidden",
                               name=key,
                               value=value,
                               extra=extra)
-                              
+        return result
+
 class TextWidget(Widget):
     """Text widget
     """
@@ -202,7 +214,7 @@
     """
     property_names = Widget.property_names +\
                      ['width', 'height', 'extra']
-    
+
     default = fields.TextAreaField('default',
                                    title='Default',
                                    description=(
@@ -210,7 +222,7 @@
                                    default="",
                                    width=20, height=3,
                                    required=0)
-    
+
     width = fields.IntegerField('width',
                                 title='Width',
                                 description=(
@@ -228,7 +240,7 @@
     def render(self, field, key, value, REQUEST):
         width = field.get_value('width')
         height = field.get_value('height')
-            
+
         return render_element("textarea",
                               name=key,
                               css_class=field.get_value('css_class'),
@@ -236,7 +248,7 @@
                               rows=height,
                               contents=html_quote(value),
                               extra=field.get_value('extra'))
-            
+
 TextAreaWidgetInstance = TextAreaWidget()
 
 class LinesTextAreaWidget(TextAreaWidget):
Common subdirectories: Formulator/www and Formulator.jp/www
