Hi,

oic,  maybe an ajax will do? I am thinking of providing a hidden form, when
user click a link in one record, it will insert the hidden form below the
selected row for user to edit, then submit it via an ajax call and close the
form, not yet tried.

A.C.


"Olof =?UTF-8?Q?N=C3=A6ss=C3=A9n" ?= wrote:
> 
> I'm afraid not. I ended up with enclosing all users in one big form. I
> thought it wasn't worth solving when the one form approach worked just
> fine in my case.
> 
> /Olof
> 
> On 29/10/2007, Angelo Chen <[EMAIL PROTECTED]> wrote:
>>
>> Hi Olof,
>>
>> Did you find a solution to this? I have similar need as yours this time.
>>
>> A.C.
>>
>>
>> "Olof =?UTF-8?Q?N=C3=A6ss=C3=A9n" ?= wrote:
>> >
>> > I have a problem with using forms in components where the data model
>> > is passed to the components via parameter inside a T5 loop component.
>> > When a form is submitted the data model seems to be lost.
>> >
>> > What I'm trying to do is to iterate through a collection of users and
>> > construct a form for each user where a user name can be edited. Each
>> > form resides in a component that handles submission. The user model
>> > data is passed to the component inside a page where a loop loops
>> > through a collection of users. The idea is to have a form for each
>> > user so when submitting a form, only the user edited will get updated.
>> > However, when a form is submitted the user data model is lost and ends
>> > up as a null pointer.
>> >
>> > I wouldn't be surprised if I've missed something obvious or if the way
>> > I try to achieve a form for each user isn't a valid usage of T5. Any
>> > thoughts or suggestions? I've attached a simple example demonstrating
>> > my approach in this email.
>> >
>> > /Olof
>> >
>> > // User.java Data Model
>> > package org.example;
>> >
>> > public class User
>> > {
>> >     private String name;
>> >
>> >     public User(String name)
>> >     {
>> >         this.name = name;
>> >     }
>> >
>> >     public String getName()
>> >     {
>> >         return name;
>> >     }
>> >
>> >     public void setName(String name)
>> >     {
>> >         this.name = name;
>> >     }
>> > }
>> >
>> > //Users.java T5 Page
>> > package org.example.testapp.pages;
>> >
>> > import java.util.ArrayList;
>> > import java.util.List;
>> >
>> > import org.apache.tapestry.annotations.Persist;
>> > import org.example.User;
>> >
>> > public class Users
>> > {
>> >     private User user;
>> >
>> >     @Persist("flash")
>> >     private List<User> users;
>> >
>> >     public void onActivate()
>> >     {
>> >         if (users == null)
>> >         {
>> >             users = new ArrayList<User>();
>> >             users.add(new User("Ted"));
>> >             users.add(new User("Olof"));
>> >         }
>> >     }
>> >
>> >     public User getUser()
>> >     {
>> >         return user;
>> >     }
>> >
>> >     public void setUser(User user)
>> >     {
>> >         this.user = user;
>> >     }
>> >
>> >     public List<User> getUsers()
>> >     {
>> >         return users;
>> >     }
>> > }
>> >
>> > // Users.html T5 Template
>> > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>> > <head>
>> > </head>
>> > <body>
>> >       <t:loop source="users" value="user">
>> >               <t:edituser user="user"/>
>> >       </t:loop>
>> > </body>
>> > </html>
>> >
>> > //EditUser.java T5 Component
>> > package org.example.testapp.components;
>> >
>> > import org.apache.tapestry.annotations.Parameter;
>> > import org.example.User;
>> >
>> > public class EditUser
>> > {
>> >     @Parameter(required = true)
>> >     private User user;
>> >
>> >     public void setUser(User user)
>> >     {
>> >         this.user = user;
>> >     }
>> >
>> >     public User getUser()
>> >     {
>> >         return user;
>> >     }
>> >
>> >     public void onSuccess()
>> >     {
>> >         // save user
>> >     }
>> > }
>> >
>> > //EditUser.html T5 Template
>> > <t:form xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>> >       <t:textfield value="user.name"/><br/>
>> >       <t:submit t:id="save" value="save"/>
>> > </t:form>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-T5--Problem-with-multiple-forms-in-a-loop-tf4533944.html#a13467431
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/-T5--Problem-with-multiple-forms-in-a-loop-tf4533944.html#a13468318
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to