I ran into this problem this morning too. I did my investigation in order to post a mail later but I found yours first.
2014-11-17 22:59 GMT+01:00 D Tim Cummings <[email protected]>: > Thanks Charlouze. This sums up the problem nicely. I have added your > comment to https://issues.apache.org/jira/browse/TAP5-2204 < > https://issues.apache.org/jira/browse/TAP5-2204> which was supposed to > resolve this issue but hasn’t. Someone needs to reopen this jira issue. > > Tim > > > > > On 18 Nov 2014, at 03:14, Charlouze <[email protected]> wrote: > > > > I agree with Tim. Documentation says that the default is auto and does > not > > require the model to be set in order to pass the submission process. > > > > I think it's a bug. As you can see in the select component code > > < > https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java#L284-306 > > > > (line > > 292), if the secure option is set to AUTO and the model is null then the > > form doesn't validate the options against the select model. But the > problem > > is that the model parameter > > < > https://github.com/apache/tapestry-5/blob/master/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Select.java#L107-108 > > > > doesn't allow null value. That's also why the error is confusing, it > cannot > > reach line 300 in the toValue method which would throw a much clearer > error. > > > > 2014-11-17 17:44 GMT+01:00 Thiago H de Paula Figueiredo < > [email protected]> > > : > > > >> On Mon, 17 Nov 2014 10:41:20 -0200, D Tim Cummings <[email protected] > > > >> wrote: > >> > >> Thanks. That wasn’t my question but it does help me. With > >>> secure="always", I would need the model for render and form > submission. So > >>> according to what you are saying I could init the model in > onActivate() OR > >>> onPrepare() OR (onPrepareForSubmit() AND setupRender()). > >>> > >> > >> I'd use onPrepare(), as it's the only one that always gets invoked when > >> rendering and before handling form submissions. > >> > >> Or just have a getter that inits and returns the model. That's what I > >> usually do. > >> > >> My actual question is why do I need to init the model in one of these > >>> methods for secure="auto" or the default secure attribute (which is > >>> supposed to be backward compatible)? > >>> > >> > >> This is done so Select never gives a value to your edited property that > >> isn't in the list of valid value (SelectModel). > >> > >> -- > >> Thiago H. de Paula Figueiredo > >> Tapestry, Java and Hibernate consultant and developer > >> http://machina.com.br > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > >
