I tried but is not working, it must be a way, or may be not ?

Here is what I did

<form t:type="form" t:id="userForm">

name : <input type="text" t:type="textfield" t:value="${user.name}"
t:id="user.name"/>

<br/>

last name : <input type="text" t:type="textfield" t:value="${user.lastName}"
t:id="user.lastName"/>

<br/>


<input t:type="submit" value="Update"   t:id="update" />
<input t:type="submit" value="Cancel"   t:id="cancel"  />

</form>



limonn wrote:
> 
> I want to have a form that represent an object, so far I have something
> but is not working.
> 
> <form t:type="form" t:id="userForm">
> 
> name : <input type="text" t:type="textfield" t:id="${user.name}"/>
> 
> <br/>
> 
> last name : <input type="text" t:type="textfield"
> t:id="${user.lastname}"/>
> 
> <br/>
> 
> 
> <input t:type="submit" value="Update"   t:id="update" />
> <input t:type="submit" value="Cancel"   t:id="cancel"  />
> 
> </form>
> 
> ----------------------------------------------------------------
> 
> and java 
> 
> (User.java is a regular class with 2 String properties name and lastName
> getters and setters )
> 
> 
> the java page
> 
> 
> import org.apache.tapestry5.annotations.InjectPage;
> import org.apache.tapestry5.annotations.Persist;
> 
> import com.limonn.entities.User;
> 
> public class Form {
>    
>     private boolean cancel;
>    
>     @InjectPage
>     private Index index;
>    
>    
>      @Persist
>     private User user;
>    
>    
>      public User getUser() {
>         return user;
>     }
> 
> 
>     public void setUser(User user) {
>         this.user = user;
>     }
> 
>    
>  
> void onSelectedFromUpdate() {
>      cancel = false;
>    
>   }    
>   void onSelectedFromCancel() {
>      cancel = true;
>   }
> 
>   Object  onSuccess() {
>      if (cancel) {
>          
>          System.out.print(" name was : " + this.user.getName() + " from
> success");
>     
>      } else {
>          
>          System.out.print(" name was : " + this.user.getName() + " from
> cancel");
>          
>      } 
>      return index;
>   }
> 
> ---------------------------------------------------------------------------------------------------
>                how you get the user.name and user.lastName as properties
> from User as object from the form ?
> 
> Thank 's in advance
> 

-- 
View this message in context: 
http://www.nabble.com/form-that-create-an-object-tp25414886p25417251.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

Reply via email to