New field type request (phone number)
- This topic has 7 replies, 5 voices, and was last updated 1 year, 8 months ago by
sandrinerodrigues.
-
AuthorPosts
-
May 4, 2022 at 1:02 AM #35861
Graceson
ParticipantHello,
I would like to request that Meta Box create a custom field type for phone numbers.
I know that this can be done with the text field and some custom validation, but I think it would be nice to have a very clean solution that is premade for people like the email field already is.
Additionally, it would be fantastic to have the option for the field to have a drop-down country selector that will auto fill the country code and change the validation format to match that country's phone number standards. Many contact form plugins have this feature, and I think it would be really powerful for this community.
Thanks!
May 4, 2022 at 1:02 PM #35867Long Nguyen
ModeratorHi,
Thanks for your feedback.
HTML5 also supports field type
tel
aka phone number. You can use it as a custom field type. Please read more here https://docs.metabox.io/html5-input-types/May 4, 2022 at 9:10 PM #35876Graceson
ParticipantHi Long,
I had forgotten that MB can do that, so thanks for pointing it out! However, what I think would be nice is a solution that is a bit more complete.
Because phone numbers around the world have different formatting systems, it would be really nice to have a field that is more flexible. That is why I propose a field that has a built-in drop-down for selecting the proper country code. Once the user has selected the code for their country, the form could automatically use the proper format validation for that country’s phone number format.
Is this something that could be done?
May 5, 2022 at 11:03 AM #35892Long Nguyen
ModeratorHi,
Thanks for your feedback.
I will inform the development team to consider improving the field
tel
to support this case.August 3, 2022 at 10:00 PM #37337Wojtek Piskorz
ParticipantYes. Formatted phone field with dropdown is something I need so much right now. Fluent forms has it and it works perfectly, but I need it from Metabox team
August 27, 2022 at 1:04 AM #38075Unakriti
ParticipantHi,
Sorry to jump in on this thread. But I could not locate the "tel" field in the dropdown - https://imgur.com/a/69MpkwC
How to get the phone format using HTML5 field?
Kind regards,
August 29, 2022 at 9:56 AM #38105Long Nguyen
ModeratorHi Unakriti,
You can just create a
text
field and add the custom attributepattern
to validate the input number as a phone field. Please read more on the documentation
https://docs.metabox.io/custom-attributes/
https://www.w3schools.com/tags/att_input_type_tel.asp
https://stackoverflow.com/questions/19611599/html5-phone-number-validation-with-patternAugust 23, 2023 at 4:05 PM #43011sandrinerodrigues
ParticipantHello Long,
I am jumping on this thread too...
Did the type "tel" disappeared from the Metabox Builder ? I can't find it under HTML5.
And I can't see any pattern option in the text field ?
Did anything change in the new version of Metabox AIO ?
Thank you,
Sandrine -
AuthorPosts
- You must be logged in to reply to this topic.