Added prompt for choice fields with placeholder
authorThierry Florac <tflorac@ulthar.net>
Wed, 16 Oct 2019 15:09:12 +0200
changeset 488 61fdcc1d5511
parent 487 33f8291a8050
child 489 41766d8b53d7
Added prompt for choice fields with placeholder
src/pyams_default_theme/shared/form/__init__.py
--- a/src/pyams_default_theme/shared/form/__init__.py	Wed Oct 16 13:53:12 2019 +0200
+++ b/src/pyams_default_theme/shared/form/__init__.py	Wed Oct 16 15:09:12 2019 +0200
@@ -146,7 +146,12 @@
                         widget.description = ' '
                         widget.label = II18n(field).query_attribute('label',
                                                                     request=request)
-                    widget.placeholder = field.placeholder
+                    elif field.field_type == 'choice':
+                        if field.placeholder:
+                            widget.prompt = True
+                            widget.promptMessage = field.placeholder
+                    else:
+                        widget.placeholder = field.placeholder
 
     @button.buttonAndHandler('title', name='submit')
     def update_content(self, action):