如何在WTForms中使用"tel","number"或其他输入类型?

编程入门 行业动态 更新时间:2024-10-06 12:27:53
本文介绍了如何在WTForms中使用"tel","number"或其他输入类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在表单中使用电话号码字段.我需要的是在Android手机上点击此字段时,而不是在通用键盘上,而是仅显示数字.

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.

我了解到可以通过使用<input type="tel"或<input type="number"来实现.

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

如何在WTForms中使用电话或数字输入类型?

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

推荐答案

WTForms文档似乎没有提供此功能,但是HTML 5中添加了所有输入类型的字段定义.

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()

在将它们添加到文档之前,这是它们在代码中的定义.

Until they're added to the docs, here's their definition in the code.

更多推荐

如何在WTForms中使用"tel","number"或其他输入类型?

本文发布于:2023-11-28 06:21:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1641275.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:或其他   类型   如何在   WTForms   tel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!