![](/img/trans.png)
[英]How do I use wtforms RadioField input to add an option with open-ended text input option?
[英]How do I use “tel”, “number”, or other input types in WTForms?
我想在表單中使用電話號碼字段。 我需要的是當這個字段在 Android 手機上點擊時,不是通用鍵盤,而是只出現數字。
我了解到這可以通過使用<input type="tel"
或<input type="number"
。
如何在 WTForms 中使用電話或數字輸入類型?
這似乎在 WTForms 文檔中缺失,但 HTML 5 中添加的所有輸入類型都有字段定義。
from wtforms.fields.html5 import TelField
phonenumber = TelField()
在將它們添加到文檔之前, 這是它們在代碼中的定義。
好的。 我找到了。
IntegerField(widget = widgets.Input(input_type="tel"))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.