htmldeformcolander

Deform - render input type to be number not text


So my problem is I want Deform render an input type number like this:

 <input type="number" name="end" value="" id="deformField4" class=" form-control ">

instead of:

 <input type="text" name="end" value="" id="deformField4" class=" form-control ">

from a source like this:

...
end = SchemaNode(
    colander.Integer(),
    title=_(u"End value"),
    validator=deferred_something
)

What can I change?


Solution

  • Solved adding a class "is_number" and then changing type attr with jQuery:

    end = SchemaNode(
        colander.Integer(),
        widget=TextInputWidget(css_class='is_number'),
        title=_(u"End value"),
        validator=deferred_add_multi_problems_validator
    )