Skip to content
This repository has been archived by the owner on Dec 17, 2020. It is now read-only.

Commit

Permalink
- Feature: Added new field "promptChoiceField" to the "All Widgets" demo
Browse files Browse the repository at this point in the history
  demonstrating the prompt message of the select widget.
  • Loading branch information
strichter committed Jun 29, 2007
1 parent 8086778 commit b7add01
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -5,6 +5,9 @@ CHANGES
Version 1.2.0 (??/??/2007)
-------------------------

- Feature: Added new field "promptChoiceField" to the "All Widgets" demo
demonstrating the prompt message of the select widget.

- Feature: Increased the integer default value of "All Widgets" demo to show
off our new internationalized converter.

Expand Down
8 changes: 7 additions & 1 deletion src/z3c/formdemo/widgets/browser.py
Expand Up @@ -46,6 +46,8 @@ class AllFields(persistent.Persistent):
choiceField = FieldProperty(interfaces.IAllFields['choiceField'])
optionalChoiceField = FieldProperty(
interfaces.IAllFields['optionalChoiceField'])
promptChoiceField = FieldProperty(
interfaces.IAllFields['promptChoiceField'])
dateField = FieldProperty(interfaces.IAllFields['dateField'])
datetimeField = FieldProperty(interfaces.IAllFields['datetimeField'])
decimalField = FieldProperty(interfaces.IAllFields['decimalField'])
Expand Down Expand Up @@ -81,8 +83,12 @@ def getContent(self):
return interfaces.IAllFields(self.context)

def updateWidgets(self):
super(AllFieldsForm, self).updateWidgets()
self.widgets = zope.component.getMultiAdapter(
(self, self.request, self.getContent()), IWidgets)
self.widgets.update()
self.widgets['hiddenField'].mode = HIDDEN_MODE
self.widgets['promptChoiceField'].prompt = True
self.widgets['promptChoiceField'].update()

def __call__(self):
self.update()
Expand Down
6 changes: 6 additions & 0 deletions src/z3c/formdemo/widgets/interfaces.py
Expand Up @@ -80,6 +80,12 @@ class IAllFields(zope.interface.Interface):
vocabulary=vocab,
required=False)

promptChoiceField = zope.schema.Choice(
title=u'Choice (Explicit Prompt)',
description=u'This is a choice field with an explicit prompt.',
vocabulary=vocab,
required=False)

dateField = zope.schema.Date(
title=u'Date',
description=u'This is a Date field.',
Expand Down

0 comments on commit b7add01

Please sign in to comment.