Yes, to switch language the client (ie. the browser) must request the server to 
render the page in the new language. If the request to switch is from an 
EventLink or ActionLink, then values entered into the form will be lost. That 
is because they use HTTP GET. If your request to switch is from a Submit, then 
values entered into the form will be sent to the server. That is because it 
uses HTTP POST.

Remember that by default the server-side is stateless (and that is a good 
thing). @Persist tells the server to keep state: it says keep a copy of the 
last rendered value of something. (By default it keeps that copy in the 
session, but there are options to keep it as a cookie, or in the URL, or 
wherever you like).

If your user really does want to switch language while working in a form (which 
is a very unusual use case) then try Submit with mode="cancel" or 
mode="unconditional". 

        
http://people.apache.org/~hlship/t5api/apidocs/org/apache/tapestry5/corelib/components/Submit.html

On 17 Jul 2014, at 8:26 pm, squallmat . <squall...@gmail.com> wrote:

> I added @Persist on a field in my form, it doesn't persist if switch
> locale. But if I try to submit (onSubmit not implemented in the .java) then
> the field become really persistente, even if I switch locale  the field
> stay filled.
> Why this behavior ? How can I get this persistency between locale switching
> without having to "fail-submit" before ?
> 
> 
> 2014-07-17 10:23 GMT+02:00 squallmat . <squall...@gmail.com>:
> 
>> I added @Persist on both source and value, now fields persist between
>> languages.
>> But localization switching reload the page, so I assume if I want the
>> field that were filled to stay filled at language switching I need to put
>> on all my Property with @Persist and refill each field in SetupRender,
>> right ?
>> 
>> Is this possible to have localization switchin without page reloading, and
>> only the labels "ajaxly" updated ?
>> 
>> 
>> 2014-07-16 21:02 GMT+02:00 Thiago H de Paula Figueiredo <
>> thiag...@gmail.com>:
>> 
>> On Wed, 16 Jul 2014 12:55:24 -0300, squallmat . <squall...@gmail.com>
>>> wrote:
>>> 
>>> Still, in the Client entity that i will persist at the submit, I store my
>>>> contacts in it :
>>>> // when adding a contact row
>>>> Object onAddRowFromContacts() {
>>>> ContactDto contactDto = new ContactDto();
>>>> 
>>>> clientDto.getContactList().add(contactDto);
>>>> 
>>>> return contactDto;
>>>> }
>>>> 
>>>> Is there a way to achieve what I want, keep my rows at language switching
>>>> without persisting in db ?
>>>> 
>>> 
>>> Look at the @Persist annotation. Session persistence. Again, it's
>>> completely unrelated to language switching.
>>> 
>>> @Persist
>>> private ContactDto contactDto;
>>> 
>>> 
>>> --
>>> Thiago H. de Paula Figueiredo
>>> Tapestry, Java and Hibernate consultant and developer
>>> http://machina.com.br
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>> 
>>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to