• 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

german comma + javascript

 
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my javascript code, I make some mathematical calculations and then set the result value to a form variable, and i access this form variable in my servlet to get the value.
Now my question is how will my javascript functions treat the decimal in numbers, comma or period?? My appl. was running fine with english way of numbers where I dont handle anywhere in my client/server code for this period/comma issue. But all of a sudden, my server side code threw a NumberFormatException when accesing the form variable. It was taking comma instead of period in decimal numbers. Why is this strange behavior? And BTW all my browser and locale settings are german, inspite of this my appl. was running OK with enlglish way of representing numbers....
AM i missing something here??
shankar.
p.s. i am unable to reproduce the exception all the time.....
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To the best of my knowledge, Javascript is only going to treat the decimal point and not the comma.
You can easily change the decimal point to a comma with no problem with reg exp and you can use that to your application if necessary.
Eric
 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Eric Pascarello:
To the best of my knowledge, Javascript is only going to treat the decimal point and not the comma.


even if all my locale settings including my browser is in german???In that case how do German applications work. Do they have to replace period with commma all over ??
[ December 16, 2003: Message edited by: shankar vembu ]
[ December 16, 2003: Message edited by: shankar vembu ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic