I believe the TextField is working correctly as is ... 
it gets a String value from the submission and applies 
it to a String property.  The problem is that your 
property is int, not String.

The path of least resistance is to use a ValidField 
instead of a TextField.  The validator will do the 
conversion between int and String.

See the Workbench for an example on setting this up.



--
[EMAIL PROTECTED]

http://tapestry.sf.net
> 
> Hello all,
> 
> I think there is something wrong with the "updateValue" 
> method in net.sf.tapestry.form.TextField.java
> 
>  public void updateValue(String value)
>  {
>  valueBinding.setString(value)
>  }
> 
> I bump in to this because I have a TextField which is bound 
> to a "int" property and when I try to update it I get a 
> "java.lang.IllegalArgumentException"
> 
> In my particular case I changed it to
> 
>  public void updateValue(String value)
>  {
>  valueBinding.setInt(Integer.parseInt(value));
>  }
> 
> and it worked fine... but this is no good.
> 
> I'm thinking that it should be something like:
> ( pseudo-code, I don't know how to do it for real )
> 
> 
> public void updateValue(String value)
> {
>  switch (valueBinding.getType())
> 
>   case "Integer" : 
>   valueBinding.setInt(Integer.parseInt(value));
> 
>   case "Boolean" : 
>   valueBinding.setBoolean(Boolean.getBoolean(value));
> 
>   case "Double" : 
>   valueBinding.setDouble(Double.parseDouble(value));
> 
>   default : valueBinding.setString(value);
> }
> 
> Did I make any sense?
> 
> Regards,
> 
> Luis Neves
> 
> 
> _______________________________________________________________
> 
> Don't miss the 2002 Sprint PCS Application Developer's Conference
> August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm
> 
> _______________________________________________
> Tapestry-developer mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/tapestry-developer

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas - 
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink

_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer

Reply via email to