Try verify if the 'user' is null in the toClient method .



2010/5/5 paha <ch_pa...@yahoo.com>

>
> Hi, it must be again some misunderstanding from my side. I have a form and
> select
> <t:form>
> <t:select t:id="supervisor" value="company?.supervisor" validate="required"
>                      encoder="supervisorEncoder" model="supervisorModel"
>                      blankOption="always"/>
> </t:form>
>
> in OnSubmit i see that all other field values of the form (and also some
> selects but with Enum as Model) get applied to company object except for
> this select. AS SOON AS i remove
> validate="required" it's get applied too. Sure i can do server-side
> validation to check if the object is not set, but is it an expected
> behavior?
>
> the supervisorEncoder is defined as
>
> public class UserValueEncoder implements ValueEncoder {
>    @Override
>    public String toClient(Object user) {
>        return ((User) user).getId().toString();
>    }
>
>    @Override
>    public Object toValue(String id) {
>        return StringUtils.isNotBlank(id)
>                ? new User().setId(Integer.parseInt(id))
>                : null;
>    }
> }
>
> again, if validate="required" is omitted, everything works as expected. but
> if not, selected value seems to never got submitted firing "required" error
> message
> --
> View this message in context:
> http://old.nabble.com/-T5.1--select-with-required-validation-tp28461777p28461777.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
>
>


-- 
Pablo Henrique dos Reis

Reply via email to