Click here to Skip to main content
14,880,672 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
calling to and calling from are two text fields to enter phone numbers and they have following validations.
Number is missing
tag must contain only numbers and a maximum field length of 18
cannot be 1212121212 or 1234567890
cannot have all the same digits
cannot be the same value as Calling From

“If the Calling To: validation fails the following error message will be shown when the user chooses done:

“Invalid Calling to phone number.
The Calling To Number:
- Must be 10 to 18 characters in length and numeric only.
- Cannot be the same value as the Calling From.
- Cannot consist of all the same numbers (for example 7777777777).
- Cannot have a format like 1212121212 or 1234567890.”

It would be really helpful if someone could help me out on this code.

[edit]Urgency deleted - OriginalGriff[/edit]
Posted
Updated 4-Mar-13 6:02am
v2
Comments
[no name] 4-Mar-13 11:54am
   
Please post the code that you have tried and describe the problem or problems that you are having with it not working as you expect. And "urgent" is not going to end well....
OriginalGriff 4-Mar-13 12:02pm
   
Urgency deleted: It may be urgent to you, but it isn't to us. All that your stressing the urgency does is to make us think you have left it too late, and want us to do it for you. This annoys some people, and can slow a response.

You could use substr and indexOf to treat the numbers as a string and with a few loops you'll have your solution. The other option is simply to use a regular expression. Get one from the web and alter it.

I'm assuming JQuery is not allowed.

You won't get a coded answer until you post the code you have.
   
Use SubString, Length functions.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900