Hi, t:id should be a valid Java identifier, you should use like t:id="lastName"。

textfield component will map the bean property(lastName) to the form field, so 
you can just think that after form submit, the bean's property is properly set. 

DH

----- Original Message ----- 
From: "limonn" <limonnd...@gmail.com>
To: <users@tapestry.apache.org>
Sent: Sunday, September 13, 2009 7:39 AM
Subject: Re: form that create an object


> 
> is not working I did try 
> 
> <input type="text" t:type="textfield" t:value="user.lastName"
> t:id="user.lastName"/>
> 
> but 
> 
> Failure parsing template context:Form.tml: Component id 'user.name' is not
> valid; component ids must be valid Java identifiers: start with a letter,
> and consist of letters, numbers and underscores
> 
> How you get an object from a form ??
> 
> Thanks
> 
> 
> 
> 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-tp25414886p25419221.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