Why not just use a validated field with a NumberValidator bean? 

-----Original Message-----
From: Norbert Sándor [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 20, 2005 12:06 PM
To: Tapestry users; Muhariz Jabeer
Subject: Re: newbie question - how to attach TextFields to int fields?

TextField handles only Strings.
Use ValidField or try something like:

<input jwcid="@TextField" value="ognl:convertedValue" />


// Your parameter or property of type int
public abstract int getValue();

public abstract void setValue(int value);

// Helper property which handles conversion
public String getConvertedValue()
{
   return Integer.toString(getValue());
}

public void setConvertedValue(String value)
{
  setValue(Integer.parseInt(value));
}

Of course apply some error checking :)

Br,
Norbi

----- Original Message ----- 
From: "Muhariz Jabeer" <[EMAIL PROTECTED]>
To: "Tapestry users" <[email protected]>
Sent: Monday, June 20, 2005 8:40 PM
Subject: newbie question - how to attach TextFields to int fields?


hi all,

i have primitive int field in an object which im trying to attach to a 
TextField component. I get a 
runtime exception for this. Is there a way to let the TextField component 
know that its storing the 
form data into an int and not a String?
.
thanks,
Muhariz.

-- 
In a long enough timeline,
every moment will feel like deja vu.
-Muhariz.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to