You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Nikita Shah <ni...@yahoo.com> on 2006/01/20 12:45:31 UTC

Limiting the fraction part in float values

 Hi
  
  I have a jsp where i want to input float values, but i dont want the  user to enter more then 1 fraction digit. Can we set this limit   ..?
  
  I have tried using f:convertNumber in following way
  
  <h:inputText size="3" id="taL7" value="#{targetactual.l7}" >            
         <f:validateDoubleRange minimum="1.0" maximum="7.0" />
         <f:convertNumber maxFractionDigits="1" />
  </h:inputText>
  
  where targetactual.l7 is of type float.
  But i get error on entering float values - "taL7": Error during model data update. 
  Any idea why do I get this error..?
   [input]  [input]  [input]   
  Any help wud be appreciated.
  
  TIA
  ~Nikita
  

		
---------------------------------
 
 What are the most popular cars?  Find out at Yahoo! Autos

RE: Limiting the fraction part in float values

Posted by fr...@pacbell.net.
I had the same problem. You need to declare the object in the
backing bean as java.lang.Number not float. You can then
convert it from/to float in the getter and setter.
 
public Number getL7() { ... }
public void setL7(Number l7) { ... }
 

  _____  

From: Nikita Shah [mailto:nikita_h_shah@yahoo.com] 
Sent: Friday, January 20, 2006 3:46 AM
To: MyFaces Discussion
Subject: Limiting the fraction part in float values


 Hi

I have a jsp where i want to input float values, but i dont want the user to
enter more then 1 fraction digit. Can we set this limit  ..?

I have tried using f:convertNumber in following way

<h:inputText size="3" id="taL7" value="#{targetactual.l7}" >            
       <f:validateDoubleRange minimum="1.0" maximum="7.0" />
       <f:convertNumber maxFractionDigits="1" />
</h:inputText>

where targetactual.l7 is of type float.
But i get error on entering float values - "taL7": Error during model data
update. 
Any idea why do I get this error..?
 
Any help wud be appreciated.

TIA
~Nikita



  _____  


What are the most popular cars? Find out at Yahoo!
<http://us.rd.yahoo.com/evt=38382/_ylc=X3oDMTEzNWFva2Y2BF9TAzk3MTA3MDc2BHNlY
wNtYWlsdGFncwRzbGsDMmF1dG9z/*http://autos.yahoo.com/newcars/popular/thisweek
.html> Autos