phone number field in advanced custom field on wordpress - validation

how to validate phone number field in advanced custom field on wordpress.Minimum number and maximum number and type only number.
/^(\d[\s-]?)?[([\s-]{0,2}?\d{3}[)]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i

If you don't want to develop your own code, you can use the Advanced Custom Fields plugin (https://wordpress.org/plugins/validated-field-for-acf/) and then use RegEx to define the allowed phone number pattern for example:
/^(\d[\s-]?)?[\(\[\s-]{0,2}?\d{3}[\)\]\s-]{0,2}?\d{3}[\s-]?\d{4}$/i
This pattern will work for a range of phone numbers but you can adapt the RegEx to your specific requirements. There already is a post on phone number validation at:
A comprehensive regex for phone number validation
I hope this helps.

Related

Pebble template phone number format

I wanted to format phone number which is passed as a string/number. I need to format that number to phone number like
Input to pebble template "5554781123". Output should be like "555.478.1123".
How do i format that number to phone number?
Generally speaking, whenever no function/filter is provided out of the box, in Pebble you can define your own function or filter (you can find more here on how to extend Pebble by creating and registering functions, filters and tests).
So you can wrap this solution into your own Pebble filter or function.

standardized international phone number field format as a string

I'd like to store phone numbers as unique user ids in my database/app which will initially roll out in the United States but could expand to other countries eventually.
My question is when storing phone numbers, what's a resilient way to store the number as a string so that I don't have any duplicate numbers from other countries overlap.
My initial thought is to do it this way
+1(212)555-5555
+{countryCode}({areaCode}){{subscriberCode}} *formatted with a hyphen for u.s numbers
Does that seem reasonable or are there any pitfalls to that? Should spaces be used? For instance I can't imagine other countries would use spaces or parenthesis in their subscriber codes... but maybe they do? It would also be nice if it followed the standard output format from ios and android phones' address books.
Here's what I'd say:
Use the plus. It indicates for certain that the country code follows and the number is not in a local format. You could also not store the plus and make an internal decision that all phone numbers will be stored with the country code, thus obviating the need for the plus.
Don't use any formatting in the storage of the number. Formatting is irrelevant when it comes to dialing and it makes searching and comparing more difficult.
Use a gem like phony_rails or phoney to format the number to local conventions when displaying.
So it looks like there is an international standard
http://en.wikipedia.org/wiki/E.164
And a node.js library that can format to that standard
https://github.com/aftership/node-phone

English words dictionary database for Windows Phone 7

I want to integrate an English dictionary function into my Windows Phone 7 application. Is there such a file or database available somewhere that contains all valid English words?
By the way, I only need something containing the list of words in order to validate inputs made by users. Other things such as definitions, phonetics, thesauruses, etc... are not needed.
Try this link (text file). It obviously doesn't have all valid words, but it should be reasonably effective.
The spell check API that's integrated isn't exposed to developers, so you'll have to make do with a text file like this.
Also, if you only need to check the validity of the word that the user enters in a text input of some kind, then all you need to do is set InputScope="Text" in the XAML declaration.
Hope this helps.

Visual Basic - Website Form Calculation

I am studying my first year in Programming and I have a slight problem in relation to Visual Basic coding. I know this sounds slightly vague, however I just wish to find out whether i need to create a variable, array or function.
I am creating a website app which processes a mobile phone order. I have designed a form which includes the quantity of mobile phones a particular customer requires, and the type of mobile phone the customer wishes to order.
I have included quantity values from 1-5 and 5 different types of mobile phones. I also have a button 'Process Order'. I just want to know how i can assign a particular type of mobile to the quantity.
In other words a calculation function where if I click process order, a price will be displayed showing exactly how much it costs for the phone + quantity needed. I have included a combo box with the list of phone types and the prices of each phone.
I want to be able to create a code which links a phone to a quantity for example Qty: 2 Type: superphone (costing £45). Once i process the order I should see a total price of £90. I am not expecting anyone to do it for me, just a simple explanation of what i need to look at in order to figure out the coding :)
It sounds like you are searching for the Dictionary class.
A dictionary matches some input (called key) to an output (called value). In principle, the same can be achieved through a function but a dictionary is more concise, can be changed at runtime, and may also be more efficient.
Conceptually, an array is just a specific type of dictionary that maps the input values 0 – n (its indices) to the indexed values.
Example:
Dim phonePrices As New Dictionary(Of String, Decimal)()
phonePrices.Add("Nookia", 12.30)
phonePrices.Add("Motolola", 12.12)
phonePrices.Add("THC", 42.00)
These prices can then be looked up by using the indexer:
Dim priceOfMyNookia = phonePrices("Nookia")

Is there a grid control or other "n" numbered-item control for Outlook Forms?

I'm developing an Outlook Form (2007) and I'm looking for a way to give the client the ability to enter an unspecified number of items - a grid, or some other way of doing this.
Is there a way to do this, or am I stuck with providing them with a fixed set of controls to enter items into?
It is not clear what the items are but from your suggestion of a grid I will presume they are values (numbers, strings, etc). If so you could almost certainly use something like comma separated values (CSV), or some other deliminator, for a standard text field.
In Outlook 2007 the To address field uses this functionality, in it the semi-colon is used to deliminate an 'unspecified number of items' - in this case email addresses.
This allows the user to enter data such as:
foo#bar.com; bat#baz.com; etc ...
Obviously CSV input would be:
something, something-else, etc ...
The other way to achieve this would be to dynamically generate the fields as required, that is programmatically build the form elements based on the user input, providing extra fields as required. For example, a simple system for multiple inputs might be work using the following logic.
Input entered -> check validity -> create new input
So that for each valid entry in a input, a new input is created below it, etc. thus allowing for an arbitrary number of input items.

Resources