You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Emmanuel DEMEY <de...@gmail.com> on 2012/08/23 10:52:24 UTC

Problem With ValidationTracker - Different controlName after an ajax request

Hi everyone,

Yesterday, I had a small problem with server-side validation with a
specific form, containing a zone :

<t:form>
    <t:errors/>
    <t:select t:id="selection" t:model="literal:choix1,choix2"
t:zone="zoneTest" />
    <t:zone t:id="zoneTest">
        <t:select t:id="selection2" t:model="literal:choix3,choix4" />
    </t:zone>
    <input t:type="submit"/>
</t:form>


@Propertyprivate String selection;

@Propertyprivate String selection2;

@Componentprivate Zone zoneTest;
	
@OnEvent(EventConstants.VALUE_CHANGED)public Block selection(){
return zoneTest.getBody();
}
	public void onValidateFromSelection2() throws ValidationException{
   throw new ValidationException("erreur");
}


When I do not choose any value on the first select, the errors element is
displayed, and also the small red cross on the right of the second select.
But after updating the zone, when I submit the form, the red cross is
missing.

I think the problem come from the IdAllocator. For example, let say the
t:id of my second select element is "select2".

When the page is rendered for the first time, the controlName of the
element is "select2".
Whe the zone is refreshed, Tapestry instantiate a new IdAllocator with a
namespace, which will be used as a suffix for each t:id and controlName.
for example select2_1394ea8bb51
If we submit the form, the ValidationTracker will store the error with this
last controlName (select2_1394ea8bb51) as a key.
But, after the rendering phase, the controlName is reset to its initial
value (select2), and the ValidationTracker do not find any errors with this
controlName.

I hope all my explications are clear. Have you already see this problem ?

-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emmanuel@gmail.com
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey

Re: Problem With ValidationTracker - Different controlName after an ajax request

Posted by Emmanuel DEMEY <de...@gmail.com>.
Yes the problem is still there. In fact the problem do not come from the
first select (t:id=selection), but the second one (t:id="selection2")

I added a clientId to selection2, and Tapestry use it for generating the
controlName.  So when i refresh all the page, I have this DOM :

<select id="myClientId2" name="myClientId2">...</select>

When I select something on the first select, the zone is updated, and
inside this zone I have something like that :
<select id="myClientId2_13953dfe479"
name="myClientId2_13953dfe479">...</select>

Note the namespace added as a suffix of the clientId and the controlName.

And during the rendering phase coming just after the submission, i have  :

<select id="myClientId2" name="myClientId2">...</select>

As the validationTracker use the controlName as a key of its map, the key
change between the action (myClientId2_13953dfe479) and rendering request
(myClientId2).

2012/8/23 Emmanuel DEMEY <de...@gmail.com>

> I have already tested it, and the problem was the same.  Tapestry use the
> clientId for generating the controlName.
> But I will test again ;).
> Manu
>
> 2012/8/23 Thiago H de Paula Figueiredo <th...@gmail.com>
>
>> On Thu, 23 Aug 2012 05:52:24 -0300, Emmanuel DEMEY <
>> demey.emmanuel@gmail.com> wrote:
>>
>>  Hi everyone,
>>>
>>
>> Hi!
>>
>> Try <t:select t:id="selection" t:model="literal:choix1,**choix2"
>> t:zone="zoneTest" clientId="selection"/> (note the clientId parameter).
>>
>> --
>> Thiago H. de Paula Figueiredo
>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
> --
> Emmanuel DEMEY
> Ingénieur Etude et Développement
> ATOS Worldline
> +33 (0)6 47 47 42 02
> demey.emmanuel@gmail.com
> http://emmanueldemey.fr/
>
> Twitter : @EmmanuelDemey
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emmanuel@gmail.com
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey

Re: Problem With ValidationTracker - Different controlName after an ajax request

Posted by Emmanuel DEMEY <de...@gmail.com>.
I have already tested it, and the problem was the same.  Tapestry use the
clientId for generating the controlName.
But I will test again ;).
Manu

2012/8/23 Thiago H de Paula Figueiredo <th...@gmail.com>

> On Thu, 23 Aug 2012 05:52:24 -0300, Emmanuel DEMEY <
> demey.emmanuel@gmail.com> wrote:
>
>  Hi everyone,
>>
>
> Hi!
>
> Try <t:select t:id="selection" t:model="literal:choix1,**choix2"
> t:zone="zoneTest" clientId="selection"/> (note the clientId parameter).
>
> --
> Thiago H. de Paula Figueiredo
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<us...@tapestry.apache.org>
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Emmanuel DEMEY
Ingénieur Etude et Développement
ATOS Worldline
+33 (0)6 47 47 42 02
demey.emmanuel@gmail.com
http://emmanueldemey.fr/

Twitter : @EmmanuelDemey

Re: Problem With ValidationTracker - Different controlName after an ajax request

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Thu, 23 Aug 2012 05:52:24 -0300, Emmanuel DEMEY  
<de...@gmail.com> wrote:

> Hi everyone,

Hi!

Try <t:select t:id="selection" t:model="literal:choix1,choix2"  
t:zone="zoneTest" clientId="selection"/> (note the clientId parameter).

-- 
Thiago H. de Paula Figueiredo

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