Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Lance Java
If you provide an encoder to your loop, select will use that. Otherwise it will ask the ValueEncoderFactory for a ValueEncoder for the type. Note that tapestry-hibernate will provide a ValueEncoder for each of your entities. Note also that ValueEncoderFactory will call the TypeCoercer as a last

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Thiago H de Paula Figueiredo
On Sun, 01 Dec 2013 19:39:24 -0200, Boris Horvat horvat.z.bo...@gmail.com wrote: Hi everyone, Hi! I am confused by the SelectModelFactory and how it picks an id. I have a code SelectModel doesn't deal with ids at all. It deals with what the options are and what their labels are. Ids

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Boris Horvat
Hi to both of you :) I don't have a loop, I just a have a simple Select component that I want to use so I was expecting that tapestry-hibernate will provide one for me. However to my suprise this didnt work :( (Thiago) I know that SelectModel doesnt deal with id's that is why I said

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Lance Java
Hmm... not sure why I said loop. If you provide an encoder to your loop, select will use that Should be If you provide an encoder to your select, it will use that. If company is in the basepackage.entities package, then tapestry-hibernate will auto-register a ValueEncoder for it. On 2

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Thiago H de Paula Figueiredo
On Mon, 02 Dec 2013 17:31:43 -0200, Boris Horvat horvat.z.bo...@gmail.com wrote: Hi to both of you :) Hi! (Thiago) I know that SelectModel doesnt deal with id's that is why I said SelectModelFactory. What I am thinking is that the factory will create a model that will use the id of the

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Boris Horvat
So does that mean that tapestry-hibernate will determine that this is a hibernate class and it will create a ValueEncoder that will then pick the id of that class and populate the option values? The class is in the correct folder and it works with hibernate without a problem, it is only that it

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Boris Horvat
This is the html output of my code from before select onchange=$(this).closest('form').submit(); class=form-control id=selectField_f31233d0c831 name=selectField option value=Company [id: 1, name: Company ACompany A/option option value=Company [id: 2, name: Company BCompany B/option /select On

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Thiago H de Paula Figueiredo
Could you please post the corresponding template and Java code? On Mon, 02 Dec 2013 18:23:37 -0200, Boris Horvat horvat.z.bo...@gmail.com wrote: This is the html output of my code from before select onchange=$(this).closest('form').submit(); class=form-control id=selectField_f31233d0c831

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Thiago H de Paula Figueiredo
On Mon, 02 Dec 2013 18:15:58 -0200, Boris Horvat horvat.z.bo...@gmail.com wrote: So does that mean that tapestry-hibernate will determine that this is a hibernate class and it will create a ValueEncoder that will then pick the id of that class and populate the option values? Yep! The

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Boris Horvat
Hm...This code of mine is part of some component. Something like inline editor and when I extract the select component outside everything works fine, so the problem is in my way of passing around the selected object. It must be trying to parse it like an Enum and that is why it defaults to the

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Thiago H de Paula Figueiredo
On Mon, 02 Dec 2013 21:27:25 -0200, Boris Horvat horvat.z.bo...@gmail.com wrote: Hm...This code of mine is part of some component. Something like inline editor and when I extract the select component outside everything works fine, so the problem is in my way of passing around the selected

Re: How does Tapestry SelectModelFactory pick the id

2013-12-02 Thread Boris Horvat
Well in my defence I tried to select only the code I consider relevant (it is posted in the above thread) but I missed the most important part :( The in-line component of mine does take Object as a value so I have reached the same conclusion as you have suggested. To provide my own ValueEncoder.

How does Tapestry SelectModelFactory pick the id

2013-12-01 Thread Boris Horvat
Hi everyone, I am confused by the SelectModelFactory and how it picks an id. I have a code public SelectModel getModel() { return modelFactroy.create(listOfMyObjects, name); } This class has the id filed that is used by the hibernate and the name which I use as a label in this