You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "squallmat ." <sq...@gmail.com> on 2014/07/22 11:14:58 UTC

loop inside a form

Hello,

as said in title I have a loop on a list of objects (with his encoder) :

<t:Form t:id="formUpdateType">
<t:Errors />
<table >
<tr >
<th>${message:typeName}</th>
<th>${message:remarks}</th>
<th></th>
</tr>
<t:Loop t:source="typeClientDtoList" t:value="typeClientDtoLoop"
t:encoder="typeClientDtoEncoder">
<tr>
<td>
<t:TextField t:value="typeClientDtoLoop.NomType" />
</td>
<td>
<t:TextField t:value="typeClientDtoLoop.Remarques" />
</td>
<td>
<t:ActionLink t:id="delete"
context="typeClientDtoLoop.Id">${message:delete}</t:ActionLink>
</td>
</tr>
</t:Loop>
</table>
<t:submit value="${message:updateTypes}" class="button" />
</t:Form>

I initialize the list of objects in onActivate() :

// initialize list of types if null
if (typeClientDtoList == null) {
       typeClientDtoList = new ArrayList<TypeClientDto>();
  typeClientDtoList = serviceTypeClient.findAllTypeClientDto();
}


I would like to be able to update/merge in DB all modifications of all
objects in my list
But when I go in the validate event of my form when I submit, each objects
still contains the initial values, not the modifications made in the
displayed textfields. It's like there is no synchronization between the
textfield and the objects.

What am I doing wrong ? How can I achieve what I want ?

Re: loop inside a form

Posted by "squallmat ." <sq...@gmail.com>.
Ok, I was doing "recordError" on the wrong form. What a stupid error :p


2014-07-22 13:14 GMT+02:00 Geoff Callender <
geoff.callender.jumpstart@gmail.com>:

> It's hard to answer without knowing a few things...
>
> Is each Errors contained by its Form?
>
> Do the Errors use globalOnly="true"?
>
> Are the error messages being generated by server-side code? And are they
> being recorded on the right form (eg. form1.recordError(....)?
>
> Are you giving each Errors an id? Is it unique?
>
> Are you giving each Form an id? Is it unique?
>
>
> On 22 Jul 2014, at 9:05 pm, squallmat . <sq...@gmail.com> wrote:
>
> > problem solved, i missed t:formstate="ITERATION"
> >
> >
> > But another little problem, In my page I have two t:Form with each one
> > having his t:errors, still, what could be the form submitted the error
> > displaying always happen on the same one, the second one in my page. Why
> ?
> >
> >
> > 2014-07-22 12:33 GMT+02:00 Geoff Callender <
> > geoff.callender.jumpstart@gmail.com>:
> >
> >> These may help:
> >>
> >>        T5.4:
> >>
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/tables/editableloop1
> >>        T5.3:
> >>
> http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/editableloop1
> >>
> >> Geoff
> >>
> >> On 22 Jul 2014, at 7:14 pm, squallmat . <sq...@gmail.com> wrote:
> >>
> >>> Hello,
> >>>
> >>> as said in title I have a loop on a list of objects (with his encoder)
> :
> >>>
> >>> <t:Form t:id="formUpdateType">
> >>> <t:Errors />
> >>> <table >
> >>> <tr >
> >>> <th>${message:typeName}</th>
> >>> <th>${message:remarks}</th>
> >>> <th></th>
> >>> </tr>
> >>> <t:Loop t:source="typeClientDtoList" t:value="typeClientDtoLoop"
> >>> t:encoder="typeClientDtoEncoder">
> >>> <tr>
> >>> <td>
> >>> <t:TextField t:value="typeClientDtoLoop.NomType" />
> >>> </td>
> >>> <td>
> >>> <t:TextField t:value="typeClientDtoLoop.Remarques" />
> >>> </td>
> >>> <td>
> >>> <t:ActionLink t:id="delete"
> >>> context="typeClientDtoLoop.Id">${message:delete}</t:ActionLink>
> >>> </td>
> >>> </tr>
> >>> </t:Loop>
> >>> </table>
> >>> <t:submit value="${message:updateTypes}" class="button" />
> >>> </t:Form>
> >>>
> >>> I initialize the list of objects in onActivate() :
> >>>
> >>> // initialize list of types if null
> >>> if (typeClientDtoList == null) {
> >>>      typeClientDtoList = new ArrayList<TypeClientDto>();
> >>> typeClientDtoList = serviceTypeClient.findAllTypeClientDto();
> >>> }
> >>>
> >>>
> >>> I would like to be able to update/merge in DB all modifications of all
> >>> objects in my list
> >>> But when I go in the validate event of my form when I submit, each
> >> objects
> >>> still contains the initial values, not the modifications made in the
> >>> displayed textfields. It's like there is no synchronization between the
> >>> textfield and the objects.
> >>>
> >>> What am I doing wrong ? How can I achieve what I want ?
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >> For additional commands, e-mail: users-help@tapestry.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: loop inside a form

Posted by Geoff Callender <ge...@gmail.com>.
It's hard to answer without knowing a few things...

Is each Errors contained by its Form?

Do the Errors use globalOnly="true"?

Are the error messages being generated by server-side code? And are they being recorded on the right form (eg. form1.recordError(....)?

Are you giving each Errors an id? Is it unique?

Are you giving each Form an id? Is it unique?


On 22 Jul 2014, at 9:05 pm, squallmat . <sq...@gmail.com> wrote:

> problem solved, i missed t:formstate="ITERATION"
> 
> 
> But another little problem, In my page I have two t:Form with each one
> having his t:errors, still, what could be the form submitted the error
> displaying always happen on the same one, the second one in my page. Why ?
> 
> 
> 2014-07-22 12:33 GMT+02:00 Geoff Callender <
> geoff.callender.jumpstart@gmail.com>:
> 
>> These may help:
>> 
>>        T5.4:
>> http://jumpstart.doublenegative.com.au/jumpstart7/examples/tables/editableloop1
>>        T5.3:
>> http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/editableloop1
>> 
>> Geoff
>> 
>> On 22 Jul 2014, at 7:14 pm, squallmat . <sq...@gmail.com> wrote:
>> 
>>> Hello,
>>> 
>>> as said in title I have a loop on a list of objects (with his encoder) :
>>> 
>>> <t:Form t:id="formUpdateType">
>>> <t:Errors />
>>> <table >
>>> <tr >
>>> <th>${message:typeName}</th>
>>> <th>${message:remarks}</th>
>>> <th></th>
>>> </tr>
>>> <t:Loop t:source="typeClientDtoList" t:value="typeClientDtoLoop"
>>> t:encoder="typeClientDtoEncoder">
>>> <tr>
>>> <td>
>>> <t:TextField t:value="typeClientDtoLoop.NomType" />
>>> </td>
>>> <td>
>>> <t:TextField t:value="typeClientDtoLoop.Remarques" />
>>> </td>
>>> <td>
>>> <t:ActionLink t:id="delete"
>>> context="typeClientDtoLoop.Id">${message:delete}</t:ActionLink>
>>> </td>
>>> </tr>
>>> </t:Loop>
>>> </table>
>>> <t:submit value="${message:updateTypes}" class="button" />
>>> </t:Form>
>>> 
>>> I initialize the list of objects in onActivate() :
>>> 
>>> // initialize list of types if null
>>> if (typeClientDtoList == null) {
>>>      typeClientDtoList = new ArrayList<TypeClientDto>();
>>> typeClientDtoList = serviceTypeClient.findAllTypeClientDto();
>>> }
>>> 
>>> 
>>> I would like to be able to update/merge in DB all modifications of all
>>> objects in my list
>>> But when I go in the validate event of my form when I submit, each
>> objects
>>> still contains the initial values, not the modifications made in the
>>> displayed textfields. It's like there is no synchronization between the
>>> textfield and the objects.
>>> 
>>> What am I doing wrong ? How can I achieve what I want ?
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


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


Re: loop inside a form

Posted by "squallmat ." <sq...@gmail.com>.
problem solved, i missed t:formstate="ITERATION"


But another little problem, In my page I have two t:Form with each one
having his t:errors, still, what could be the form submitted the error
displaying always happen on the same one, the second one in my page. Why ?


2014-07-22 12:33 GMT+02:00 Geoff Callender <
geoff.callender.jumpstart@gmail.com>:

> These may help:
>
>         T5.4:
> http://jumpstart.doublenegative.com.au/jumpstart7/examples/tables/editableloop1
>         T5.3:
> http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/editableloop1
>
> Geoff
>
> On 22 Jul 2014, at 7:14 pm, squallmat . <sq...@gmail.com> wrote:
>
> > Hello,
> >
> > as said in title I have a loop on a list of objects (with his encoder) :
> >
> > <t:Form t:id="formUpdateType">
> > <t:Errors />
> > <table >
> > <tr >
> > <th>${message:typeName}</th>
> > <th>${message:remarks}</th>
> > <th></th>
> > </tr>
> > <t:Loop t:source="typeClientDtoList" t:value="typeClientDtoLoop"
> > t:encoder="typeClientDtoEncoder">
> > <tr>
> > <td>
> > <t:TextField t:value="typeClientDtoLoop.NomType" />
> > </td>
> > <td>
> > <t:TextField t:value="typeClientDtoLoop.Remarques" />
> > </td>
> > <td>
> > <t:ActionLink t:id="delete"
> > context="typeClientDtoLoop.Id">${message:delete}</t:ActionLink>
> > </td>
> > </tr>
> > </t:Loop>
> > </table>
> > <t:submit value="${message:updateTypes}" class="button" />
> > </t:Form>
> >
> > I initialize the list of objects in onActivate() :
> >
> > // initialize list of types if null
> > if (typeClientDtoList == null) {
> >       typeClientDtoList = new ArrayList<TypeClientDto>();
> >  typeClientDtoList = serviceTypeClient.findAllTypeClientDto();
> > }
> >
> >
> > I would like to be able to update/merge in DB all modifications of all
> > objects in my list
> > But when I go in the validate event of my form when I submit, each
> objects
> > still contains the initial values, not the modifications made in the
> > displayed textfields. It's like there is no synchronization between the
> > textfield and the objects.
> >
> > What am I doing wrong ? How can I achieve what I want ?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: loop inside a form

Posted by Geoff Callender <ge...@gmail.com>.
These may help:

	T5.4: http://jumpstart.doublenegative.com.au/jumpstart7/examples/tables/editableloop1
	T5.3: http://jumpstart.doublenegative.com.au/jumpstart/examples/tables/editableloop1

Geoff

On 22 Jul 2014, at 7:14 pm, squallmat . <sq...@gmail.com> wrote:

> Hello,
> 
> as said in title I have a loop on a list of objects (with his encoder) :
> 
> <t:Form t:id="formUpdateType">
> <t:Errors />
> <table >
> <tr >
> <th>${message:typeName}</th>
> <th>${message:remarks}</th>
> <th></th>
> </tr>
> <t:Loop t:source="typeClientDtoList" t:value="typeClientDtoLoop"
> t:encoder="typeClientDtoEncoder">
> <tr>
> <td>
> <t:TextField t:value="typeClientDtoLoop.NomType" />
> </td>
> <td>
> <t:TextField t:value="typeClientDtoLoop.Remarques" />
> </td>
> <td>
> <t:ActionLink t:id="delete"
> context="typeClientDtoLoop.Id">${message:delete}</t:ActionLink>
> </td>
> </tr>
> </t:Loop>
> </table>
> <t:submit value="${message:updateTypes}" class="button" />
> </t:Form>
> 
> I initialize the list of objects in onActivate() :
> 
> // initialize list of types if null
> if (typeClientDtoList == null) {
>       typeClientDtoList = new ArrayList<TypeClientDto>();
>  typeClientDtoList = serviceTypeClient.findAllTypeClientDto();
> }
> 
> 
> I would like to be able to update/merge in DB all modifications of all
> objects in my list
> But when I go in the validate event of my form when I submit, each objects
> still contains the initial values, not the modifications made in the
> displayed textfields. It's like there is no synchronization between the
> textfield and the objects.
> 
> What am I doing wrong ? How can I achieve what I want ?


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