How do I use “tel”, “number”, or other input types in WTForms?

喜欢而已 提交于 2019-12-04 01:30:36

问题


I want to use a phone number field in my form. What I need is when this field is tapped on Android phone, not general keyboard, but digital only appears.

I learned that this can be achieved by using <input type="tel" or <input type="number".

How do I use the tel or number input types in WTForms?


回答1:


This appears to be missing from the WTForms docs, but there are field definitions for all the input types added in HTML 5.

from wtforms.fields.html5 import TelField

phonenumber = TelField()



回答2:


Ok. I found it.

IntegerField(widget = widgets.Input(input_type="tel"))



来源:https://stackoverflow.com/questions/36240900/how-do-i-use-tel-number-or-other-input-types-in-wtforms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!