Currency JavaScript

Hello,

I have one AJAX application. As you all know, AJAX will send ansynchronous request to the server so that it does not need to refresh the page. However, I have one problem. As I send the values back to my JSP page, I want the value in textbox to be formatted to currency so that 20.7773 becomes €20.78.

Well, I can find many function freely available to do that. However, after the value is converted and formatted, I change the value in textbox again and the value is sent back to the server. It reports that it is not valid number as it contains €

Can you all suggest me the best way to tackle this problem?

Thanks
David
LVL 16
suprapto45Asked:
Who is Participating?
 
WebstormCommented:
Hi suprapto45,

I don't think it's a good idea to add the € in the textbox.
You may instead put &euro; in front of the textbox like:  &euro; <input ...

0
 
bubbledragonCommented:
remove the &euro; on submit
or use a hidden field to pass the value without &euro, use this field value after submit.
0
 
suprapto45Author Commented:
I will agree to Webstorm in this case. So both of you are providing valid answer.

Thanks
David
0
 
WebstormCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.