Text Input Masks

Captured

None

Code (show in context)

    @view_config(renderer='templates/form.pt', name='text_input_masks')
    @demonstrate('Text Input Masks')
    def text_input_masks(self):
        class Schema(colander.Schema):
            ssn = colander.SchemaNode(
                colander.String(),
                widget = deform.widget.TextInputWidget(mask='999-99-9999'),
                )
            date = colander.SchemaNode(
                colander.String(),
                widget = deform.widget.TextInputWidget(mask='99/99/9999'),
                )
        schema = Schema()
        form = deform.Form(schema, buttons=('submit',))
        return self.render_form(form)