Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1313347
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 9 years ago.
Improve this questionWe're trying to restrict a text field to numbers only. Here's what we've tried
- Add text field
- Apply input mask (9999999999)
The problem is that if someone does not fully complete the field, the number is erased when they tab into the next field or if they click anywhere outside of that field. It should not matter how many characters they put into the field, it should just restrict the field to a number.
If one only puts one 9 in the field, it restricts the field to 1 number. With the input mask set to ten 9's, you can enter 10 numbers. The problem is that if you do not enter the exact number, it clear the field once it loses focus.
We can do this with jQuery but we're hoping that Gravity has a hidden gem we've missed somewhere?
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 9 years ago.
Improve this questionWe're trying to restrict a text field to numbers only. Here's what we've tried
- Add text field
- Apply input mask (9999999999)
The problem is that if someone does not fully complete the field, the number is erased when they tab into the next field or if they click anywhere outside of that field. It should not matter how many characters they put into the field, it should just restrict the field to a number.
If one only puts one 9 in the field, it restricts the field to 1 number. With the input mask set to ten 9's, you can enter 10 numbers. The problem is that if you do not enter the exact number, it clear the field once it loses focus.
We can do this with jQuery but we're hoping that Gravity has a hidden gem we've missed somewhere?
Share Improve this question edited Dec 21, 2015 at 19:15 SixfootJames asked Dec 21, 2015 at 13:33 SixfootJamesSixfootJames 4573 gold badges11 silver badges23 bronze badges 3- As per the screenshot which you have provided, you want user to enter 10 digits. Ideally, clearing the value should be OK if user does not enter complete 10 digits. Please clarify if you want to allow user to input less than 10 digits? – Prasad Nevase Commented Dec 21, 2015 at 14:53
- @ItsMePN, I have made some edits to clarify. – SixfootJames Commented Dec 21, 2015 at 19:15
- Thanks, I was going to provide same answer which David provided below. I think you shall be good now. – Prasad Nevase Commented Dec 22, 2015 at 4:15
1 Answer
Reset to default 4If you add a question mark before your string of 9s, this will work as desired. It makes the completion optional. It will still enforce a max limit based on the number of 9s you have but there will be no minimum limit.
本文标签: Restricting text field to numbers only in Gravity Forms
版权声明:本文标题:Restricting text field to numbers only in Gravity Forms 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741946876a2406470.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论