-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WTForms: expose HTML5 fields #214
Comments
On second thought, it should not be in the model definition. Maybe in I'm wondering:
|
Since old browsers fallback on text input if they don't handle new type input, it is probably safe to use HTML5 inputs wherever possible. For instance
In this case, I don't see the need for a parameter to specify whether or not to use them: what regression could it cause? It should be quite straightforward to use a majority if not all of those fields already. There might be corner cases a bit tricky to address, though. For instance, the regex that validates a URL might not be the same as the one specified in URLField. |
I made a local modification to use HTML5 from WTforms. Problem is for Datetime field. There are inconsistencies in browser support and seconds are not supported, while the underlying field does. So it is better to have it as a normal text-field or a custom date-picker. |
Thanks for the feedback. So you confirm that using HTML5 inputs by default won't harm (older browser will fallback to text input), so there's no need to make this optional, right? In this case, I don't think anyone will object to adding this feature. Do you have some code you would like to push here? Let's add the easy ones already, and deal with the tricky ones like Datetime later on. |
Well, I haven't tested my code with many browsers, so cannot confirm no harm, but I give +1 for the idea. |
Since WTForms 3.0.0 HTML5 is default. This may raise only WTForms < 3.0.0 and Flask-Mongoengine compatibility issues... So I need to think about correct limits and make some tests before 2.0.0 release |
I checked compatibility, and according tests nothing broke in #497 |
WTForms added fields to support various HTML5 input types.
It would be nice to expose these.
Currently, I suppose on can subclass
ModelConverter
to override some converters.We could add support in flask-mongoengine code. Maybe using a kwarg in the model definition.
The text was updated successfully, but these errors were encountered: