aspose file tools
The moose likes JSF and the fly likes convertNumber question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "convertNumber question" Watch "convertNumber question" New topic
Author

convertNumber question

Liviu Mitrofan
Greenhorn

Joined: Sep 03, 2008
Posts: 7
Hi,

In my project I use myfaces and tomahawk, and I have a question concerning the convertNumber tag.
In my jsf code I have this statement:
<f:convertNumber pattern="###,###,###,##0" minIntegerDigits="1" maxIntegerDigits="12" maxFractionDigits="0" />

But I want to change this behavior accordingly with a radio button. These radio buttons are meter and km. When the user selects "meter" radio button then he can insert a number without a comma. But when he selects the km radio button, he can insert a number with 3 decimals, which later will be converted in meters.

Which is the correct approach to this problem.
Any suggestion will be appreciated.
Thank you
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 14491
    
    7

You MAY be able to supply the pattern as a variable:

<f:convertNumber pattern="#{backingBean.inputPattern}" minIntegerDigits="1" maxIntegerDigits="12" maxFractionDigits="0" />

But you need to check the spec on f:convertNumber. Not all attributes are allowed to be expressions, and I don't know if the patter attribute is one of them or not.

Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: convertNumber question
 
Similar Threads
[convertNumber] currencySymbol and hex code
Need Help on HTML
convertNumber and rounding mode
How do I NOT require currency symbol on input, but still display it with convertNumber?
convertNumber and currencySymbol