Your problem is definitely with the Required validator, although it's a little suspect that a valid User.toString() returns an empty string or that you are building incomplete entities in the ValueEncoder. In my opinion the validator should not be returning an error.
public void validate(Field field, Void constraintValue, MessageFormatter formatter, Object value) throws ValidationException { if (value == null || InternalUtils.isBlank(value.toString())) throw new ValidationException(buildMessage(formatter, field)); } I'm not sure why value.toString() is called. The class is documented as "A validator that enforces that the value is not null and not the empty string." Perhaps it should be checking that value is an instance of String before testing for blank? A workaround (way around) would be to create your own implementation of the Required validator. Perhaps a NotNull validator that only checks for null? Maybe one already exists out there but I didn't look. Josh On Wed, May 5, 2010 at 1:22 PM, paha <ch_pa...@yahoo.com> wrote: > > > Thiago H. de Paula Figueiredo wrote: >> >> You should provide your own ValueEncoder that doesn't rely on toString(). >> > well if you've read my first post, you could see that my ValueEncoder > doesn't rely on toString(). It is rather Tapestry Validator, that runs > toString on User object and assumes it is null, when it is not. > > > Thiago H. de Paula Figueiredo wrote: >> >>> if i set either name or surname property to some dummy value, things >>> work again. Is it expected behavior? >> >> Tapestry's Required validator treats empty string as null. >> > the problem is, the object returned from valueencoder is not a string and it > is not empty. i don't know the internals, i cannot criticize. imho objects > returned from valuencoder schould be only checked against null unless they > are really strings. > > unfortunately, there is no hint in ValueEncoder, that a toValue method must > return an object , whose toString() method returns not null. in contrary it > states "the corresponding entity, or null if not found". in my case User > instance with correct id is an corresponding entity, but it is treated as > not found because of toString > -- > View this message in context: > http://old.nabble.com/-T5.1--select-with-required-validation-tp28461777p28466005.html > Sent from the Tapestry - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- -- http://www.bodylabgym.com - a private, by appointment only, one-on-one health and fitness facility. -- http://www.ectransition.com - Quality Electronic Cigarettes at a reasonable price! -- TheDailyTube.com. Sign up and get the best new videos on the internet delivered fresh to your inbox. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org