输入类型='数字'新验证删除Safari for iPhone iOS5和最新的Safari for Mac中的前导零和格式编号 [英] Input type='number' new validation removes leading zeros and formats number in Safari for iPhone iOS5 and latest Safari for Mac

查看:110
本文介绍了输入类型='数字'新验证删除Safari for iPhone iOS5和最新的Safari for Mac中的前导零和格式编号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最新的MacOS Safari和iOS5中的Safari会有一些额外的验证,如果文本字段不是电话号码,会导致问题。

The latest Safari for MacOS and the one that comes in iOS5 has some extra validation that causes problems if the text field is not a phone number.

案例:输入带有 type =numeric属性的文本字段。

Case: Input text field with type="numeric" attribute.

问题:
1)号码被格式化为电话号码。例如。如果我键入'012345678',它将被格式化为'012 345 678'

Problems: 1) Number gets formatted as a phone number. E.g. if I type '012345678' it gets formatted as '012 345 678'

2)正在移除前导零。例如。 '01234567'格式化为'1234567'

2) Leading zeros are being removed. E.g. '01234567' gets formatted as '1234567'

我可以删除文本字段中的 type =numeric属性,可能还有问题将消失,但我真的想在这个文本字段中使用数字小键盘而不是iPhone上的普通键盘。

I could just remove the type="numeric" attribute on my text field and probably the problem will disappear, but I would really like to use the numeric keypad for this text field instead of the normal keyboard on the iPhone.

任何想法如何解决这个问题?

Any ideas how to fix this?

非常感谢

推荐答案

我将 type =number更改为 type =tel并正常工作。我做了一些快速测试,但没有找到任何验证或自动格式化文本。

I change type="number" to type="tel" and works fine. I did some quick testing and have not found any validation or auto-formatting of the text either.

这篇关于输入类型='数字'新验证删除Safari for iPhone iOS5和最新的Safari for Mac中的前导零和格式编号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆