• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

it gives like"phone no must be an integer"! why?

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

i have created login for with fields like username and password,and registration form with fields like username ,password,email,address and phone no.

And i did the validations too!and modified the applications.properties file in resource folder.
And i created one DataBase table with that of five fields,and there i took 'phno int(15)'in MySqlquery.


Ok,now the browser displays the registration form,and now i am facing the problem here only :when i enter more than 10 numbers in phone no and try to click on submit,then it gives like"phone no must be an integer"!

I dont know the reason why it coming like this!
can anyone let me know the mistake i made?

Thank you in advance

Regards,
sree.
 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry!here in posting the above query i made a mistake.that is
Actually in creation DataBase table,i took like this:"phno varchar(15)".

Regards,
Sree
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't make yourself clear but I'll give it a shot.

You are validating a phone number as an integer.
Java's max integer value is 2^31-1 that's 2147483647 and if I count correctly that's a 10 digit number. Go above this and you don't have an integer any more.

The rest is up to you to figure out. Use regexp to validate it and store it in varchar that would be a solution.
 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Tamas,

yiu have given the sentence thst is
"Use regexp to validate it and store it in varchar that would be a solution."
i didn't get it!can you make me much more clarified?

Regards,
sree
 
sreelakshmi kolla
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any help please!

Thanks in Advance!

Regards,
sree
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Use masking to verify the phone number rather than cheking the integer, sample below.

<field property="phone"
depends="maxlength, mask">

<arg1 name="maxlength" key="${var:maxlength}" />
<var>
<var-name>maxlength</var-name>
<var-value>50</var-value>
</var>
<var>
<var-name>mask</var-name>
<var-value>^[0-9]*$</var-value>
</var>
</field>
 
Tamas Jano
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep, that's exactly what I was talking about.

You can even use formatting with regular expressions and it will accept the number only in certain formats you give (like xxx-xx.xx.xx).

Thanks Amy!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic