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

Commit

Permalink
Added hidden widget to widget sample
Browse files Browse the repository at this point in the history
  • Loading branch information
projekt01 committed Jun 17, 2007
1 parent 7fc957d commit 983f9d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/z3c/formdemo/widgets/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

from z3c.form.interfaces import IWidgets
from z3c.form import form, field
from z3c.form.interfaces import HIDDEN_MODE
from z3c.formdemo.widgets import interfaces
from z3c.template.interfaces import ILayoutTemplate

Expand Down Expand Up @@ -63,6 +64,7 @@ class AllFields(persistent.Persistent):
timedeltaField = FieldProperty(interfaces.IAllFields['timedeltaField'])
tupleField = FieldProperty(interfaces.IAllFields['tupleField'])
uriField = FieldProperty(interfaces.IAllFields['uriField'])
hiddenField = FieldProperty(interfaces.IAllFields['hiddenField'])

# register the AllField class as a annotation adapter
getAllFields = factory(AllFields)
Expand All @@ -76,6 +78,10 @@ class AllFieldsForm(form.EditForm):
def getContent(self):
return interfaces.IAllFields(self.context)

def updateWidgets(self):
super(AllFieldsForm, self).updateWidgets()
self.widgets['hiddenField'].mode = HIDDEN_MODE

def __call__(self):
self.update()
layout = zope.component.getMultiAdapter((self, self.request),
Expand Down
5 changes: 5 additions & 0 deletions src/z3c/formdemo/widgets/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,8 @@ class IAllFields(zope.interface.Interface):
title=u'URI',
description=u'This is a URI field.',
default='http://zope.org')

hiddenField = zope.schema.TextLine(
title=u'Hidden Text Line',
description=u'This is a hidden TextLine field.',
default=u'Some Hidden Text.')

0 comments on commit 983f9d2

Please sign in to comment.