This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Number formatting in text input

 
Jamie Williams
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to show numbers in an input text field on a form to 5 points of precision eg 0.25 must be shown as 0.25000
That's easy, but submitting them again and converting them to floats doesn't work, I get conversion errors. I thought I could get around the problem by having a get method that returns a string, and a set method that takes a float, eg.



But this doesn't work. I get 'Conversion Error "newPrice": Error during model data update.' Can anyone help me?
 
Bagwan Mehrat
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder if f:convertNumber would do what you want. If not, then you can write a custom converter, a class that implements javax.faces.convert.Convert.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic