Permalink
Browse files

demo the optional label for the checkbox widget

  • Loading branch information...
1 parent 548f678 commit 55342402515b96f3f357f8478220f13d62a20438 @cguardia cguardia committed Mar 20, 2013
Showing with 14 additions and 0 deletions.
  1. +14 −0 deformdemo/__init__.py
View
14 deformdemo/__init__.py
@@ -340,6 +340,20 @@ class Schema(colander.Schema):
form = deform.Form(schema, buttons=('submit',))
return self.render_form(form)
+ @view_config(renderer='templates/form.pt', name='checkbox_with_label')
+ @demonstrate('Checkbox with Label')
+ def checkbox_with_label(self):
+ class Schema(colander.Schema):
+ want = colander.SchemaNode(
+ colander.Boolean(),
+ description='Check this box!',
+ widget=deform.widget.CheckboxWidget(),
+ label='Really',
+ title='I Want It!')
+ schema = Schema()
+ form = deform.Form(schema, buttons=('submit',))
+ return self.render_form(form)
+
@view_config(renderer='templates/form.pt', name='radiochoice')
@demonstrate('Radio Choice Widget')
def radiochoice(self):

0 comments on commit 5534240

Please sign in to comment.