You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Hugo Palma <hu...@gmail.com> on 2007/10/15 11:08:35 UTC

T5: Setting properties to null

It seems that properties associated with form fields are never set to 
null even if the submitted is empty. This would be ok if the property 
was coerced into a String as i could simply check for an empty String. 
The problem is different when it's coerced to an Integer or to a Double 
because if the user submits an empty form field the page get's the 
Integer or Double representing 0.

I've tracked the problem down to the TypeCoercer implementation. The 
given implementation coerces null values into the default value of a 
type. So if you want to coerce a null to a Double if return 0.0d instead 
of just null.
I'm not sure if this is actually intended behavior and there's probably 
an easy way through configuration or something to solve my use case or 
if it's a bug.

Any ideas ?

Re: T5: Setting properties to null

Posted by Hugo Palma <hu...@gmail.com>.
Thanks, i've added a comment to the issue.

Nick Westgate wrote:
> This was changed a month ago by Howard. There's already a complaint
> attached to the closed issue:
> https://issues.apache.org/jira/browse/TAPESTRY-1648
>
> Perhaps it should be re-opened and re-examined.
>
> Cheers,
> Nick.
>
>
> Hugo Palma wrote:
>> It seems that properties associated with form fields are never set to 
>> null even if the submitted is empty. This would be ok if the property 
>> was coerced into a String as i could simply check for an empty 
>> String. The problem is different when it's coerced to an Integer or 
>> to a Double because if the user submits an empty form field the page 
>> get's the Integer or Double representing 0.
>>
>> I've tracked the problem down to the TypeCoercer implementation. The 
>> given implementation coerces null values into the default value of a 
>> type. So if you want to coerce a null to a Double if return 0.0d 
>> instead of just null.
>> I'm not sure if this is actually intended behavior and there's 
>> probably an easy way through configuration or something to solve my 
>> use case or if it's a bug.
>>
>> Any ideas ?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: T5: Setting properties to null

Posted by Nick Westgate <ni...@key-planning.co.jp>.
This was changed a month ago by Howard. There's already a complaint
attached to the closed issue:
https://issues.apache.org/jira/browse/TAPESTRY-1648

Perhaps it should be re-opened and re-examined.

Cheers,
Nick.


Hugo Palma wrote:
> It seems that properties associated with form fields are never set to 
> null even if the submitted is empty. This would be ok if the property 
> was coerced into a String as i could simply check for an empty String. 
> The problem is different when it's coerced to an Integer or to a Double 
> because if the user submits an empty form field the page get's the 
> Integer or Double representing 0.
> 
> I've tracked the problem down to the TypeCoercer implementation. The 
> given implementation coerces null values into the default value of a 
> type. So if you want to coerce a null to a Double if return 0.0d instead 
> of just null.
> I'm not sure if this is actually intended behavior and there's probably 
> an easy way through configuration or something to solve my use case or 
> if it's a bug.
> 
> Any ideas ?
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org