Thanks Geoff, I already found how to change the Add row :)

What is still stucking me is that language switching, I can't do it with
form because we can't nest them.
Is there a way in an actionlink to force persisting of the properties of a
page ?


2014-07-17 16:10 GMT+02:00 Geoff Callender <
geoff.callender.jumpst...@gmail.com>:

> A form will only submit what it contains. You need a single form that
> contains all your "switch" submits, the AjaxFormLoop, and anything else you
> don't want to lose.
>
> Regarding changing "Add a Row", it's just text in this example...
>
>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/ajax/formloop1
>
> ...which you could replace with something like ${message:add-a-row-label}
> and a corresponding entry in app.properties or your localisation solution...
>
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/localization/bymessagecatalog
>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/localization/bytemplate
>
> Geoff
>
> On 17 Jul 2014, at 11:32 pm, squallmat . <squall...@gmail.com> wrote:
>
> > hello Geoff,
> > I just changed my actionlinks to form-submit :
> >
> > <li style="float: right">
> > <t:Form t:id="englishForm">
> > <t:Submit t:mode="UNCONDITIONAL"
> > t:image="asset:classpath:layout/images/en.jpg" class="imgflag" alt="en"/>
> > </t:Form>
> > </li>
> > <li style="float: right; border: none">
> > <t:Form t:id="frenchForm">
> > <t:Submit t:mode="UNCONDITIONAL"
> > t:image="asset:classpath:layout/images/fr.jpg" class="imgflag" alt="fr"/>
> > </t:Form>
> > </li>
> >
> >
> > @Component(id = "englishForm")
> > private Form englishForm;
> >
> > @Component(id = "frenchForm")
> > private Form frenchForm;
> >
> > @OnEvent(value = EventConstants.SUCCESS, component = "englishForm")
> > public Object onSuccess() {
> > persistentLocale.set(new Locale("en"));
> > return null;
> > }
> >
> > @OnEvent(value = EventConstants.SUCCESS, component = "frenchForm")
> > public Object onSuccesstwo() {
> > persistentLocale.set(new Locale("fr"));
> > return null;
> > }
> >
> >
> > But that still continue to do the same thing. Is it necessary that my
> forms
> > with submit switching language covers the field that we want persisted ?
> > Because the switching language links/submit are in component layout.
> > Is there another way/method/trick to achieve what I want ?
> >
> >
> > 2014-07-17 12:36 GMT+02:00 Geoff Callender <
> > geoff.callender.jumpst...@gmail.com>:
> >
> >> 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
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to