wood burning stoves*
The moose likes JSP and the fly likes validating phone number or email id totally through our app Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "validating phone number or email id totally through our app" Watch "validating phone number or email id totally through our app" New topic
Author

validating phone number or email id totally through our app

Pramod Krishna Murthy
Ranch Hand

Joined: Jun 30, 2009
Posts: 37

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.


"Nothing is forever except Change"
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
If you need to verify that the e-mail address/phone number belongs to the user, you will need his intervention!


OCJP 6 (93%)
Lorand Komaromi
Ranch Hand

Joined: Oct 08, 2009
Posts: 276
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

Joined: Jan 10, 2002
Posts: 61221
    
  66

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4658
    
    5

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

Joined: Jun 30, 2009
Posts: 37

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

Joined: Jun 30, 2009
Posts: 37

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

Joined: Nov 23, 2009
Posts: 4
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

Joined: Oct 08, 2009
Posts: 276
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

Joined: Oct 08, 2009
Posts: 276
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

Joined: Jun 30, 2009
Posts: 37

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

Joined: Jun 30, 2009
Posts: 37

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

Joined: Jun 30, 2009
Posts: 37

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

Joined: Jun 30, 2009
Posts: 37

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

Joined: Aug 11, 2007
Posts: 4658
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: validating phone number or email id totally through our app