tags:

views:

89

answers:

1

Is it possible to have some of the new attribute only attributes used in HTML5, inside of WTForms?

Eg, say you want to create a TextField with placeholder="foo", required, and autofocus attributes. How would this be done in WTForms?

In html it would look like this: <input maxlength="256" name="q" value="" placeholder="foo" autofocus required>

Note that placeholder="foo" is easily done in WTForms. autofocus and required, because they have no value, are .. well, as far as i've seen, not supported in WTForms.

Can WTForms support this?

+1  A: 

You'll probably need to create a custom widget.

Check out the docs on custom widgets.

a paid nerd