[Checkins] SVN: z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component. initialize emptyText attribute for combobox using noValueMessage or promptMesssage if specified

Laurent Mignon Laurent.Mignon at softwareag.com
Tue Jul 7 03:21:19 EDT 2009


Log message for revision 101677:
  initialize emptyText attribute for combobox using noValueMessage or promptMesssage if specified

Changed:
  U   z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.py
  U   z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.txt

-=-
Modified: z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.py
===================================================================
--- z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.py	2009-07-07 07:17:55 UTC (rev 101676)
+++ z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.py	2009-07-07 07:21:19 UTC (rev 101677)
@@ -200,11 +200,15 @@
 
     def _getConfig(self, json=False):
         config = super(ComboBox, self)._getConfig()
+        emptyText = [self.widget.noValueMessage]
+        if self.widget.prompt:
+            emptyText = [self.widget.promptMessage]
         config.update(dict(
             hiddenName = config['name']+':list',
             triggerAction = 'all',
             editable = True,
             forceSelection = True,
+            emptyText = emptyText,
             store= [(item['value'], item['content'])
                 for item in self.widget.items],
             ))

Modified: z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.txt
===================================================================
--- z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.txt	2009-07-07 07:17:55 UTC (rev 101676)
+++ z3c.formext/branches/sagblmi-morecomponent/src/z3c/formext/component.txt	2009-07-07 07:21:19 UTC (rev 101677)
@@ -221,6 +221,7 @@
   >>> choiceWidget.update()
   >>> pprint(interfaces.IExtJSComponent(choiceWidget).getConfig())
   {'editable': True,
+   'emptyText': [u'no value'],
    'fieldLabel': u'Choice',
    'forceSelection': True,
    'hiddenName': 'choiceField:list',
@@ -243,8 +244,9 @@
   ...     IFieldWidget)
   >>> choiceWidget.update()
   >>> pprint(interfaces.IExtJSComponent(choiceWidget).getConfig())
-  {'editable': True,                                                                                               
-   'fieldLabel': u'Choice (Not Required)',                                                                          
+  {'editable': True,                      
+   'emptyText': [u'no value'],
+   'fieldLabel': u'Choice (Not Required)',
    'forceSelection': True,
    'hiddenName': 'optionalChoiceField:list',                                                                        
    'id': 'optionalChoiceField',                                                                                     
@@ -647,6 +649,7 @@
 
   >>> pprint(config['items'][3])
   {'editable': True,
+   'emptyText': [u'no value'],
    'fieldLabel': u'Gender',
    'forceSelection': True,
    'hiddenName': 'form.widgets.gender:list',



More information about the Checkins mailing list