• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

german comma + javascript

 
shankar vembu
Ranch Hand
Posts: 309
  • Mark post as helpful
  • send pies
  • 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.....
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • 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
  • 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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic