File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

validating phone number or email id totally through our app

 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi , this is pramod here. i am given a very interesting task of validating phone number or email id in web applications. normally what happens is ,server will send an email to mail
id provided by the user and it contains a link(which has to be clicked), this confirms that the mail id is valid. with the phone number what usually happens is ,user is asked to send a sms to server. again
this confirms that the phone number is valid. but i want to do it totally through our application dynamically. this means there is no user validating a mail link or sending sms or something else.

i have been told it is possible and it is done in one of the projects. but i am not been able to figure it how to do it. please help me on this. i hope you got the idea. if there needs to be more information given, please post a reply to this quote. i'll reply to it as soon as possible.

 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need to verify that the e-mail address/phone number belongs to the user, you will need his intervention!
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod krishnamurhty wrote:i have been told it is possible and it is done in one of the projects.


Then ask the person who told this to show you the code! But most likely he misunderstood you...

And by the way, welcome to JavaRanch!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64178
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please use bold text sparingly for emphasis when posting, rather than for entire posts. It makes posts hard to read and less likely to generate responses. I have adjusted your topic for you.
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod krishnamurhty wrote:validating phone number or email id in web applications

For email addresses:

What do you mean by "validating" here? Just that the format is proper? That the email host exists? or that there is a person who receives the email?

Your example of common usage answers the third, and its the only way that I know of to address the third question.

Look for an RFC822 parser to address the first.

For phone numbers, I have no clue what you are really asking.
 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:
pramod krishnamurhty wrote:validating phone number or email id in web applications

For email addresses:

What do you mean by "validating" here? Just that the format is proper? That the email host exists? or that there is a person who receives the email?

Your example of common usage answers the third, and its the only way that I know of to address the third question.

Look for an RFC822 parser to address the first.

For phone numbers, I have no clue what you are really asking.


validating here is not the format. that is very easy using javascript. the task is to check whether the mail id actually exists or not. i asked the person for guidance. but he said me "to explore on your own" . thanks for replying
 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod krishnamurhty wrote:
Pat Farrell wrote:
pramod krishnamurhty wrote:validating phone number or email id in web applications

For email addresses:

What do you mean by "validating" here? Just that the format is proper? That the email host exists? or that there is a person who receives the email?

Your example of common usage answers the third, and its the only way that I know of to address the third question.

Look for an RFC822 parser to address the first.

For phone numbers, I have no clue what you are really asking.


validating here is not the format. that is very easy using javascript. the task is to check whether the mail id actually exists or not. i asked the person for guidance. but he said me "to explore on your own" . thanks for replying



please tell me more about the RFC822 parser. at first even i argued validating ph no or mail id without any sort of back checking is not possible. but i came to know it is possible. but its very difficult in logical sense i guess


 
Snehal Bachchhav
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi check this ....
JS Code to check mobile number
if(mobilenoFlag=='true'){
mobilenumber=document.getElementById('mobilenumbertxtbox').value;

if(mobilenumber=='')
{
alert("Please Enter Mobile No.");
return;
}
//if(isNaN(mobilenumber))
//{
//alert("Please Enter Mobile No Correctly.");
///return;
//}
//if(mobilenumber.length !=10)
//{
//alert("Please Enter 10 digit Mobile No .");
//return;
//}

}else{
mobilenumber='-';
}
if(emailidFlag=='true'){
emailid=document.getElementById('emailidtxtbox').value;


var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

if(reg.test(emailid) == false)
{
alert('Invalid Email Address.');
return ;
}
if(emailid=='')
{
alert("Please Enter Email_id.");
return;
}


}else{
emailid='-';
}


 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod krishnamurhty wrote: the task is to check whether the mail id actually exists or not.



Take a look at this!
 
Lorand Komaromi
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Snehal Bachchhav wrote:Hi check this ....
JS Code to check mobile number



pramod krishnamurhty wrote:
validating here is not the format. that is very easy using javascript. the task is to check whether the mail id actually exists or not.

 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Snehal Bachchhav wrote:Hi check this ....
JS Code to check mobile number
if(mobilenoFlag=='true'){
mobilenumber=document.getElementById('mobilenumbertxtbox').value;

if(mobilenumber=='')
{
alert("Please Enter Mobile No.");
return;
}
//if(isNaN(mobilenumber))
//{
//alert("Please Enter Mobile No Correctly.");
///return;
//}
//if(mobilenumber.length !=10)
//{
//alert("Please Enter 10 digit Mobile No .");
//return;
//}

}else{
mobilenumber='-';
}
if(emailidFlag=='true'){
emailid=document.getElementById('emailidtxtbox').value;


var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

if(reg.test(emailid) == false)
{
alert('Invalid Email Address.');
return ;
}
if(emailid=='')
{
alert("Please Enter Email_id.");
return;
}


}else{
emailid='-';
}






thanks snehal for replying to my post. but that is not what i was looking for. the code you have given validates for syntactic errors and for 10 numbers. what if i enter say 1234567890 . this no will still be valid. to avoid this, we developers normally ask the user to validate his ph no or email id. i want to do it totally through our app and not depending on user sending a validation sms or mail
 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:Please use bold text sparingly for emphasis when posting, rather than for entire posts. It makes posts hard to read and less likely to generate responses. I have adjusted your topic for you.


ok thanks for reminding me
 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lorand Komaromi wrote:
pramod krishnamurhty wrote: the task is to check whether the mail id actually exists or not.



Take a look at this!


thanks , just now i saw the site. it seems very interesting .hope it will solve my problem
 
Pramod Krishna Murthy
Ranch Hand
Posts: 37
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod krishnamurhty wrote:
Lorand Komaromi wrote:
pramod krishnamurhty wrote: the task is to check whether the mail id actually exists or not.



Take a look at this!


thanks , just now i saw the site. it seems very interesting .hope it will solve my problem


i guess that's the way to it. it involves server side coding. everything happens dynamically. its a good code.
 
Pat Farrell
Rancher
Posts: 4660
5
Linux Mac OS X VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
pramod krishnamurhty wrote:validating here is not the format. that is very easy using javascript. the task is to check whether the mail id actually exists or not.

Actually, proper RFC822 parsing is very complex. The usual Javascript code only works for 95% or so of legal cases. That may be good enough for your use case.

Using a proper parser is always easy, but writing one is another topic.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic