Re: T5 Newbie : populate the value of a form in a bean

2007-11-16 Thread Michael Courcy
In my case I think I was running in confusion, the MyObject was already initialized from a previous page and injected in the page that hold the form. Thus initialising it from onPrepareFromForm or setupRender is useless in this particular case. Things are working fine now, I really don't see

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Michael Courcy
The title property of the video object is updated, I don't have a title property on my page class. I can't compile anything right now, but I'll try to put together a small example tonight, if someone else hasn't posted something by then. Josh Josh It would be really really nice !!! If you do

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Ezra Epstein
Is it that the user object is null on page load? If so, see the BeanEditForm's implementation of void onPrepareFromForm() Michael Courcy [EMAIL PROTECTED] wrote: You're right here it is, I remove the offending input and use this instead ${user}-- ${user.name} And I get [EMAIL

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Michael Courcy
Thanks a lot Josh I'm going to try it now Josh Canfield a écrit : Hey Michael, I didn't get to it last night, but here you go, a very simple example: ** Start.tml html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head titleForm Test/title /head body

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Michael Courcy
Ok thanks. I need to work on this component anyway. But things are not totally clear in my mind of the state of @Persist objects during the phase request. I 'm going to work on this as well. Ezra Epstein a écrit : Is it that the user object is null on page load? If so, see the

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Josh Canfield
Hey Michael, I didn't get to it last night, but here you go, a very simple example: ** Start.tml html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head titleForm Test/title /head body MyObject:br/ Name: ${myObject.name}br/ Number:

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Howard Lewis Ship
Generally, what you want to do is replace setupRender() with onPrepareFromForm(). void onPrepareFromForm() { if (_myObject == null) _myObject = new MyObject(); } Prepare means the prepare event, fired from your Form component. Prepare event is triggered when the form starts to render AND when

Re: T5 Newbie : populate the value of a form in a bean

2007-11-15 Thread Michael Courcy
I've tried it It works, got to understand my errors now. Thanks a lot. Josh Canfield a écrit : Hey Michael, I didn't get to it last night, but here you go, a very simple example: ** Start.tml html xmlns:t=http://tapestry.apache.org/schema/tapestry_5_0_0.xsd; head titleForm

T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Michael Courcy
Hi In my Page I have a property User, and I want to directly populate the value of the form to the bean User User.java class User{ private String name; private String surName; getters ans setters . } Start.java class Start{ private User user; getters and setters }

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Thiago H de Paula Figueiredo
On Wed, 14 Nov 2007 11:24:03 -0200, Michael Courcy [EMAIL PROTECTED] wrote: input t:type=TextField t:id=user.name t:value=user.name/ Try t:id=name instead of t:id=user.name. ;) The t:id attribute is not meant as a way to tell Tapestry what are you editing: it's just an id that you can use

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread CarstenM
Hi, have you tried it with @ApplicationState private User user; in your page class ? Michael Courcy wrote: Hi In my Page I have a property User, and I want to directly populate the value of the form to the bean User User.java class User{ private String name; private String

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Michael Courcy
The t:id attribute is not meant as a way to tell Tapestry what are you editing: it's just an id that you can use to refer to it in another component (Label, for example) or in your page class. Ok you're right but if I try this input t:type=TextField t:value=user.name/ I get a failure

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Thiago H de Paula Figueiredo
On Wed, 14 Nov 2007 12:47:06 -0200, Michael Courcy [EMAIL PROTECTED] wrote: input t:type=TextField t:id=name t:value=user.name/ I have to provide the setter and the getter for name and I still get an error when I submit. What error? Make sure your user field is not null when the form is

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Michael Courcy
I'm 100% sure, user is not null I have a getter and a setter for both : name and user Thanks Thiago H de Paula Figueiredo a écrit : On Wed, 14 Nov 2007 12:47:06 -0200, Michael Courcy [EMAIL PROTECTED] wrote: input t:type=TextField t:id=name t:value=user.name/ I have to provide the setter

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Ezra Epstein
I always pause when hearing 100% sure. An easy check/test is to remove the offending input and stick in a simple ${user} and see if indeed you get the toString() value for your user object. Michael Courcy [EMAIL PROTECTED] wrote: I'm 100% sure, user is not null I have a getter and a setter

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Michael Courcy
You're right here it is, I remove the offending input and use this instead ${user}-- ${user.name} And I get [EMAIL PROTECTED] -- A name Obviously user is not null. I think the problem does not come from tapestry but from me. I want to populate from the form directly to the bean. But this

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Josh Canfield
I want to populate from the form directly to the bean. But this require to use either the beanEditForm or a custom component. You can get this to work. I use the textfield component for editing my bean objects. This is from a working emplate: input t:id=*title* t:type=*textfield* t:size=*40*

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Michael Courcy
Thanks Josh, but do you have also a title property with getter and setter in your page class ? And if yes (as I guess) whish value is updated when you submit the form : MyPage.title or MyPage.video.title ? Josh Canfield a écrit : I want to populate from the form directly to the bean. But

Re: T5 Newbie : populate the value of a form in a bean

2007-11-14 Thread Josh Canfield
Hi Michael, Thanks Josh, but do you have also a title property with getter and setter in your page class ? No, I only have the video getter/setter And if yes (as I guess) whish value is updated when you submit the form : MyPage.title or MyPage.video.title ? The title property of the