You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Paul Stanton <pa...@mapshed.com.au> on 2010/06/17 23:29:24 UTC
zone updated form loses dom ids
I have a form which is part of a zone which gets updated regularly (for
example, when the form is submitted).
the first time the pages loads, the form and its textfield's ids are as
expected ie exactly what is entered as t:id
eg
<input t:type="textfield" t:id="myTextField" />
=
<input type="text" id="myTextField" />
however, once the zone has been updated, the ids for the form and the
textfields within it have a code appended to them:
eg
<input type="text" id="myTextField-12947ccd236" />
Unfortunately I have scripts which need to reference these fields by
their Id, so when the Id changes the scripts break:
eg
$("myTextField").value = "myValue";
how have other people handled this?
thanks, paul.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: zone updated form loses dom ids
Posted by Paul Stanton <pa...@mapshed.com.au>.
A tidier option is to wrap the tapestry component in a <span> with an id
and use $("spansId").down()....
Howard Lewis Ship wrote:
> Regenerate your listeners when you do the partial page render; get the
> clientId from each field and make sure you observe changes to that
> element. Don't try to predict what ids Tapestry will use.
>
> On Thu, Jun 17, 2010 at 2:29 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
>
>> I have a form which is part of a zone which gets updated regularly (for
>> example, when the form is submitted).
>>
>> the first time the pages loads, the form and its textfield's ids are as
>> expected ie exactly what is entered as t:id
>> eg
>> <input t:type="textfield" t:id="myTextField" />
>> =
>> <input type="text" id="myTextField" />
>>
>> however, once the zone has been updated, the ids for the form and the
>> textfields within it have a code appended to them:
>> eg
>> <input type="text" id="myTextField-12947ccd236" />
>>
>>
>> Unfortunately I have scripts which need to reference these fields by their
>> Id, so when the Id changes the scripts break:
>> eg
>> $("myTextField").value = "myValue";
>>
>> how have other people handled this?
>>
>> thanks, paul.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
Re: zone updated form loses dom ids
Posted by Howard Lewis Ship <hl...@gmail.com>.
Regenerate your listeners when you do the partial page render; get the
clientId from each field and make sure you observe changes to that
element. Don't try to predict what ids Tapestry will use.
On Thu, Jun 17, 2010 at 2:29 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
> I have a form which is part of a zone which gets updated regularly (for
> example, when the form is submitted).
>
> the first time the pages loads, the form and its textfield's ids are as
> expected ie exactly what is entered as t:id
> eg
> <input t:type="textfield" t:id="myTextField" />
> =
> <input type="text" id="myTextField" />
>
> however, once the zone has been updated, the ids for the form and the
> textfields within it have a code appended to them:
> eg
> <input type="text" id="myTextField-12947ccd236" />
>
>
> Unfortunately I have scripts which need to reference these fields by their
> Id, so when the Id changes the scripts break:
> eg
> $("myTextField").value = "myValue";
>
> how have other people handled this?
>
> thanks, paul.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator of Apache Tapestry
The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!
(971) 678-5210
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: zone within zone problem
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Thu, 17 Jun 2010 21:39:03 -0300, Paul Stanton <pa...@mapshed.com.au>
wrote:
> isn't that what i'm doing via t:id="zoneB"?
No. t:id is the component id, while id is the HTML id. If you don't
provide the HTML id, the component will generate one based on the t:id.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: zone within zone problem
Posted by Paul Stanton <pa...@mapshed.com.au>.
isn't that what i'm doing via
t:id="zoneB"
?
Howard Lewis Ship wrote:
> Set an explcit id parameter for zone B. It looks repetitive, but it's
> the correct thing here.
>
> On Thu, Jun 17, 2010 at 2:56 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
>
>> Hi All,
>>
>> I've just noticed that if you update a zone that contains another zone, you
>> can no longer update the contained zone.
>>
>> this may be related to my prior post regarding id's changing after a zone
>> update.
>>
>> see example: (click 'update zone b' which works, click 'update zone a' which
>> works, click 'update zone b' which doesn't work).
>>
>> public class Start
>> {
>> @InjectComponent
>> private Zone zoneA;
>> @InjectComponent
>> private Zone zoneB;
>> @Property
>> private String zoneAContent;
>> @Property
>> private String zoneBContent;
>>
>> private Object onActionFromLinkA()
>> {
>> zoneAContent = new Date().toString();
>> return new MultiZoneUpdate("zoneA", zoneA);
>> }
>>
>> private Object onActionFromLinkB()
>> {
>> zoneBContent = new Date().toString();
>> return new MultiZoneUpdate("zoneB", zoneB);
>> }
>> }
>>
>> tml:
>>
>> <t:zone t:id="zoneA" style="border:1px solid blue;">
>> <h2>Zone A</h2>
>> ${zoneAContent}
>> <t:zone t:id="zoneB" style="border:1px solid red;">
>> <h2>Zone B</h2>
>> ${zoneBContent}
>> </t:zone>
>> </t:zone>
>>
>> <a t:type="actionlink" t:id="linkA" zone="zoneA">Update Zone A</a>
>> <a t:type="actionlink" t:id="linkB" zone="zoneB">Update Zone B</a>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
>
>
>
Re: zone within zone problem
Posted by Howard Lewis Ship <hl...@gmail.com>.
Set an explcit id parameter for zone B. It looks repetitive, but it's
the correct thing here.
On Thu, Jun 17, 2010 at 2:56 PM, Paul Stanton <pa...@mapshed.com.au> wrote:
> Hi All,
>
> I've just noticed that if you update a zone that contains another zone, you
> can no longer update the contained zone.
>
> this may be related to my prior post regarding id's changing after a zone
> update.
>
> see example: (click 'update zone b' which works, click 'update zone a' which
> works, click 'update zone b' which doesn't work).
>
> public class Start
> {
> @InjectComponent
> private Zone zoneA;
> @InjectComponent
> private Zone zoneB;
> @Property
> private String zoneAContent;
> @Property
> private String zoneBContent;
>
> private Object onActionFromLinkA()
> {
> zoneAContent = new Date().toString();
> return new MultiZoneUpdate("zoneA", zoneA);
> }
>
> private Object onActionFromLinkB()
> {
> zoneBContent = new Date().toString();
> return new MultiZoneUpdate("zoneB", zoneB);
> }
> }
>
> tml:
>
> <t:zone t:id="zoneA" style="border:1px solid blue;">
> <h2>Zone A</h2>
> ${zoneAContent}
> <t:zone t:id="zoneB" style="border:1px solid red;">
> <h2>Zone B</h2>
> ${zoneBContent}
> </t:zone>
> </t:zone>
>
> <a t:type="actionlink" t:id="linkA" zone="zoneA">Update Zone A</a>
> <a t:type="actionlink" t:id="linkB" zone="zoneB">Update Zone B</a>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
--
Howard M. Lewis Ship
Creator of Apache Tapestry
The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!
(971) 678-5210
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
zone within zone problem
Posted by Paul Stanton <pa...@mapshed.com.au>.
Hi All,
I've just noticed that if you update a zone that contains another zone,
you can no longer update the contained zone.
this may be related to my prior post regarding id's changing after a
zone update.
see example: (click 'update zone b' which works, click 'update zone a'
which works, click 'update zone b' which doesn't work).
public class Start
{
@InjectComponent
private Zone zoneA;
@InjectComponent
private Zone zoneB;
@Property
private String zoneAContent;
@Property
private String zoneBContent;
private Object onActionFromLinkA()
{
zoneAContent = new Date().toString();
return new MultiZoneUpdate("zoneA", zoneA);
}
private Object onActionFromLinkB()
{
zoneBContent = new Date().toString();
return new MultiZoneUpdate("zoneB", zoneB);
}
}
tml:
<t:zone t:id="zoneA" style="border:1px solid blue;">
<h2>Zone A</h2>
${zoneAContent}
<t:zone t:id="zoneB" style="border:1px solid red;">
<h2>Zone B</h2>
${zoneBContent}
</t:zone>
</t:zone>
<a t:type="actionlink" t:id="linkA" zone="zoneA">Update Zone A</a>
<a t:type="actionlink" t:id="linkB" zone="zoneB">Update Zone B</a>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org