You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Arno Haase <ar...@haase-consulting.com> on 2012/05/12 16:59:42 UTC

referencing a form from JS

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I want a JavaScript event handler to programatically submit a form.
This works well using form.performSubmit() (I want Tapestry's AJAX
submit).

The tricky part is that the form being submitted is part of the zone
that is being refreshed by the submit, while the element causing the
submit is not.

So referencing the form by its ID is out, since the form is assigned a
new and different ID after each AJAX zone refresh. Calling click() on
a hidden button is out for the same reason.

I currently have stuff working by using

document.forms[2]

(there are currently three forms on the page), but that is a fragile hack.

Any suggestions on how to improve this?



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+uetgACgkQbmZsMyUPuXTmmQCg4Z50r8FDXo+EPL8WSQFEG5Lt
t5QAoKPW6M87LyU4KW3bD1Xs1IHMWzoz
=Vcmu
-----END PGP SIGNATURE-----

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


Re: referencing a form from JS

Posted by Arno Haase <ar...@haase-consulting.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks for that solution. It's not really a beauty, but it is way
better than what I had previously ;-)

Am 12.05.2012 21:46, schrieb Bryan Lewis:
> We dealt with this issue by writing a javascript function to find
> the mangled ID, based on the original ID.  Maybe it'll help. We''l
> pass the ID of the containing element, often a div, to narrow the
> search.
> 
> 
> // Returns the ID of a component with a name beginning with the
> partialId. // When Tapestry replaces a block of html in a zone
> update, it appends a numeric // suffix to the original ID which
> makes it hard to find the component // when we want to re-attach a
> javascript handler. function getRealId(partialId, parentId) { var
> re = new RegExp(partialId,'g'); var str; 
> $(parentId).childElements().each(function(e) { if
> (e.identify().match(re)) { str = e.identify(); return; } }); return
> str; }
> 
> 
> We'd use it like:
> 
> <t:textfield t:id="high0" value="tier0.high" class="txt" 
> style="width:80px;" onblur="aec(this)" onchange="initLow('low1',
> 'high0');"/>
> 
> 
> On Sat, May 12, 2012 at 2:32 PM, Arno Haase
> <arno.haase@haase-consulting.com
>> wrote:
> 
> Thanks for posting this.
> 
> I am not sure how it helps though - that piece of code assumes
> that the ID of the form is known while I try to figure out what the
> id of the form is.
> 
> 
> 
> Am 12.05.2012 19:06, schrieb Lenny Primak:
>>>> Perhaps this will help:
>>>> 
>>>> 
> http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/DisableAfterSubmit.js
>>>>
>>>>
> 
Notice setSubmittingElement() call
>>>> 
>>>> 
>>>> On May 12, 2012, at 10:45 AM, Arno Haase 
>>>> <ar...@haase-consulting.com> wrote:
>>>> 
>>>> It does, unfortunately.
>>>> 
>>>> When the form is initially rendered, Tapestry assigns it the
>>>> id I assign in the .tml file. On subsequent *AJAX* refreshs,
>>>> Tapestry appends some number to the initial id.
>>>> 
>>>> I have
>>>> 
>>>> <t:zone t:id="zone" id="zone" show="show" update="show">
>>>> <t:form t:id="dynamicForm" id="dynamicForm" zone="zone"
>>>> autofocus="false">
>>>> 
>>>> ... </t:form> </t:zone>
>>>> 
>>>> in the .tml file, and a DOM inspection after an AJAX refresh
>>>> of the zone shows
>>>> 
>>>> <div id="zone" class="t-zone tapestry-zone"> <form 
>>>> id="dynamicForm_13741814fec" class="t-prevent-submission" 
>>>> method="post" action="/webbib/de/versesearch.dynamicform">
>>>> 
>>>> ...
>>>> 
>>>> </form> </div>
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Am 12.05.2012 17:17, schrieb Thiago H. de Paula Figueiredo:
>>>>>>> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase 
>>>>>>> <ar...@haase-consulting.com> wrote:
>>>>>>> 
>>>>>>>> So referencing the form by its ID is out, since the
>>>>>>>> form is assigned a new and different ID after each
>>>>>>>> AJAX zone refresh.
>>>>>>> 
>>>>>>> This won't happen if you give an explicit id (not t:id,
>>>>>>> id) for the form.
>>>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>>
>>>>>
>
>>>>> 
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
>>>> 
>>>> 
>> 
>> ---------------------------------------------------------------------
>>
>> 
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+u++MACgkQbmZsMyUPuXQbFwCePFtoVh9P6UaRVlnNyqhT0NTr
+X4An2bsWTKOLZaAFoaZhGTQLopNMpZK
=Xig7
-----END PGP SIGNATURE-----

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


Re: referencing a form from JS

Posted by Arno Haase <ar...@haase-consulting.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hey, that's a great idea - thanks!

Am 14.05.2012 18:04, schrieb Norman Franke:
> I generally give the object I want to find a unique CSS class, and
> find it via prototype: $$('form.fooBar')[0]
> 
> Norman Franke Answering Service for Directors, Inc. www.myasd.com
> 
> 
> 
> On May 12, 2012, at 3:46 PM, Bryan Lewis wrote:
> 
>> We dealt with this issue by writing a javascript function to find
>> the mangled ID, based on the original ID.  Maybe it'll help.
>> We''l pass the ID of the containing element, often a div, to
>> narrow the search.
>> 
>> 
>> // Returns the ID of a component with a name beginning with the
>> partialId. // When Tapestry replaces a block of html in a zone
>> update, it appends a numeric // suffix to the original ID which
>> makes it hard to find the component // when we want to re-attach
>> a javascript handler. function getRealId(partialId, parentId) { 
>> var re = new RegExp(partialId,'g'); var str; 
>> $(parentId).childElements().each(function(e) { if
>> (e.identify().match(re)) { str = e.identify(); return; } }); 
>> return str; }
>> 
>> 
>> We'd use it like:
>> 
>> <t:textfield t:id="high0" value="tier0.high" class="txt" 
>> style="width:80px;" onblur="aec(this)" onchange="initLow('low1',
>> 'high0');"/>
>> 
>> 
>> On Sat, May 12, 2012 at 2:32 PM, Arno Haase
>> <arno.haase@haase-consulting.com
>>> wrote:
>> 
> Thanks for posting this.
> 
> I am not sure how it helps though - that piece of code assumes
> that the ID of the form is known while I try to figure out what the
> id of the form is.
> 
> 
> 
> Am 12.05.2012 19:06, schrieb Lenny Primak:
>>>>> Perhaps this will help:
>>>>> 
>>>>> 
> http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/DisableAfterSubmit.js
>>>>>
>>>>>
> 
Notice setSubmittingElement() call
>>>>> 
>>>>> 
>>>>> On May 12, 2012, at 10:45 AM, Arno Haase 
>>>>> <ar...@haase-consulting.com> wrote:
>>>>> 
>>>>> It does, unfortunately.
>>>>> 
>>>>> When the form is initially rendered, Tapestry assigns it
>>>>> the id I assign in the .tml file. On subsequent *AJAX*
>>>>> refreshs, Tapestry appends some number to the initial id.
>>>>> 
>>>>> I have
>>>>> 
>>>>> <t:zone t:id="zone" id="zone" show="show" update="show">
>>>>> <t:form t:id="dynamicForm" id="dynamicForm" zone="zone"
>>>>> autofocus="false">
>>>>> 
>>>>> ... </t:form> </t:zone>
>>>>> 
>>>>> in the .tml file, and a DOM inspection after an AJAX
>>>>> refresh of the zone shows
>>>>> 
>>>>> <div id="zone" class="t-zone tapestry-zone"> <form 
>>>>> id="dynamicForm_13741814fec" class="t-prevent-submission" 
>>>>> method="post" action="/webbib/de/versesearch.dynamicform">
>>>>> 
>>>>> ...
>>>>> 
>>>>> </form> </div>
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Am 12.05.2012 17:17, schrieb Thiago H. de Paula
>>>>> Figueiredo:
>>>>>>>> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase 
>>>>>>>> <ar...@haase-consulting.com> wrote:
>>>>>>>> 
>>>>>>>>> So referencing the form by its ID is out, since the
>>>>>>>>> form is assigned a new and different ID after each
>>>>>>>>> AJAX zone refresh.
>>>>>>>> 
>>>>>>>> This won't happen if you give an explicit id (not
>>>>>>>> t:id, id) for the form.
>>>>>>>> 
>>>>>> 
>>>>>> ---------------------------------------------------------------------
>>>>>>
>>>>>>
>
>>>>>> 
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
>>>>> 
>>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>>
>>> 
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail:
>>> users-help@tapestry.apache.org
>>> 
>>> 
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+xlf0ACgkQbmZsMyUPuXQ01wCeKDzmHfqogR68q04NvnLnX3u+
VCsAn2pUbGwNTySQWmlsowVrYYve/gHl
=aj27
-----END PGP SIGNATURE-----

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


Re: referencing a form from JS

Posted by Norman Franke <no...@myasd.com>.
I generally give the object I want to find a unique CSS class, and find it via prototype: $$('form.fooBar')[0]

Norman Franke
Answering Service for Directors, Inc.
www.myasd.com



On May 12, 2012, at 3:46 PM, Bryan Lewis wrote:

> We dealt with this issue by writing a javascript function to find the
> mangled ID,
> based on the original ID.  Maybe it'll help. We''l pass the ID of the
> containing element,
> often a div, to narrow the search.
> 
> 
> // Returns the ID of a component with a name beginning with the partialId.
> // When Tapestry replaces a block of html in a zone update, it appends a
> numeric
> // suffix to the original ID which makes it hard to find the component
> // when we want to re-attach a javascript handler.
> function getRealId(partialId, parentId)
> {
>    var re = new RegExp(partialId,'g');
>    var str;
>    $(parentId).childElements().each(function(e) {
>        if (e.identify().match(re)) {
>            str = e.identify();
>            return;
>        }
>    });
>    return str;
> }
> 
> 
> We'd use it like:
> 
> <t:textfield t:id="high0" value="tier0.high" class="txt"
> style="width:80px;" onblur="aec(this)"
>                onchange="initLow('low1', 'high0');"/>
> 
> 
> On Sat, May 12, 2012 at 2:32 PM, Arno Haase <arno.haase@haase-consulting.com
>> wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>> 
>> Thanks for posting this.
>> 
>> I am not sure how it helps though - that piece of code assumes that
>> the ID of the form is known while I try to figure out what the id of
>> the form is.
>> 
>> 
>> 
>> Am 12.05.2012 19:06, schrieb Lenny Primak:
>>> Perhaps this will help:
>>> 
>>> 
>> http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/DisableAfterSubmit.js
>>> 
>>> Notice setSubmittingElement() call
>>> 
>>> 
>>> On May 12, 2012, at 10:45 AM, Arno Haase
>>> <ar...@haase-consulting.com> wrote:
>>> 
>>> It does, unfortunately.
>>> 
>>> When the form is initially rendered, Tapestry assigns it the id I
>>> assign in the .tml file. On subsequent *AJAX* refreshs, Tapestry
>>> appends some number to the initial id.
>>> 
>>> I have
>>> 
>>> <t:zone t:id="zone" id="zone" show="show" update="show"> <t:form
>>> t:id="dynamicForm" id="dynamicForm" zone="zone" autofocus="false">
>>> 
>>> ... </t:form> </t:zone>
>>> 
>>> in the .tml file, and a DOM inspection after an AJAX refresh of
>>> the zone shows
>>> 
>>> <div id="zone" class="t-zone tapestry-zone"> <form
>>> id="dynamicForm_13741814fec" class="t-prevent-submission"
>>> method="post" action="/webbib/de/versesearch.dynamicform">
>>> 
>>> ...
>>> 
>>> </form> </div>
>>> 
>>> 
>>> 
>>> 
>>> Am 12.05.2012 17:17, schrieb Thiago H. de Paula Figueiredo:
>>>>>> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase
>>>>>> <ar...@haase-consulting.com> wrote:
>>>>>> 
>>>>>>> So referencing the form by its ID is out, since the form
>>>>>>> is assigned a new and different ID after each AJAX zone
>>>>>>> refresh.
>>>>>> 
>>>>>> This won't happen if you give an explicit id (not t:id, id)
>>>>>> for the form.
>>>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> 
>>>> 
>> 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
>>> 
>>> 
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.11 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>> 
>> iEYEARECAAYFAk+urNQACgkQbmZsMyUPuXTIpgCgjY/9UjnaDtRj0THpJXfHwphM
>> 9RsAniYFQPJOabdyeHGrWd5iXFNrYQ34
>> =Ws5J
>> -----END PGP SIGNATURE-----
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>> 
>> 


Re: referencing a form from JS

Posted by Bryan Lewis <jb...@gmail.com>.
We dealt with this issue by writing a javascript function to find the
mangled ID,
based on the original ID.  Maybe it'll help. We''l pass the ID of the
containing element,
often a div, to narrow the search.


// Returns the ID of a component with a name beginning with the partialId.
// When Tapestry replaces a block of html in a zone update, it appends a
numeric
// suffix to the original ID which makes it hard to find the component
// when we want to re-attach a javascript handler.
function getRealId(partialId, parentId)
{
    var re = new RegExp(partialId,'g');
    var str;
    $(parentId).childElements().each(function(e) {
        if (e.identify().match(re)) {
            str = e.identify();
            return;
        }
    });
    return str;
}


We'd use it like:

<t:textfield t:id="high0" value="tier0.high" class="txt"
style="width:80px;" onblur="aec(this)"
                onchange="initLow('low1', 'high0');"/>


On Sat, May 12, 2012 at 2:32 PM, Arno Haase <arno.haase@haase-consulting.com
> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Thanks for posting this.
>
> I am not sure how it helps though - that piece of code assumes that
> the ID of the form is known while I try to figure out what the id of
> the form is.
>
>
>
> Am 12.05.2012 19:06, schrieb Lenny Primak:
> > Perhaps this will help:
> >
> >
> http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/DisableAfterSubmit.js
> >
> >  Notice setSubmittingElement() call
> >
> >
> > On May 12, 2012, at 10:45 AM, Arno Haase
> > <ar...@haase-consulting.com> wrote:
> >
> > It does, unfortunately.
> >
> > When the form is initially rendered, Tapestry assigns it the id I
> > assign in the .tml file. On subsequent *AJAX* refreshs, Tapestry
> > appends some number to the initial id.
> >
> > I have
> >
> > <t:zone t:id="zone" id="zone" show="show" update="show"> <t:form
> > t:id="dynamicForm" id="dynamicForm" zone="zone" autofocus="false">
> >
> > ... </t:form> </t:zone>
> >
> > in the .tml file, and a DOM inspection after an AJAX refresh of
> > the zone shows
> >
> > <div id="zone" class="t-zone tapestry-zone"> <form
> > id="dynamicForm_13741814fec" class="t-prevent-submission"
> > method="post" action="/webbib/de/versesearch.dynamicform">
> >
> > ...
> >
> > </form> </div>
> >
> >
> >
> >
> > Am 12.05.2012 17:17, schrieb Thiago H. de Paula Figueiredo:
> >>>> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase
> >>>> <ar...@haase-consulting.com> wrote:
> >>>>
> >>>>> So referencing the form by its ID is out, since the form
> >>>>> is assigned a new and different ID after each AJAX zone
> >>>>> refresh.
> >>>>
> >>>> This won't happen if you give an explicit id (not t:id, id)
> >>>> for the form.
> >>>>
> >>
> >> ---------------------------------------------------------------------
> >>
> >>
> 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
> >
> >
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAk+urNQACgkQbmZsMyUPuXTIpgCgjY/9UjnaDtRj0THpJXfHwphM
> 9RsAniYFQPJOabdyeHGrWd5iXFNrYQ34
> =Ws5J
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: referencing a form from JS

Posted by Arno Haase <ar...@haase-consulting.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thanks for posting this.

I am not sure how it helps though - that piece of code assumes that
the ID of the form is known while I try to figure out what the id of
the form is.



Am 12.05.2012 19:06, schrieb Lenny Primak:
> Perhaps this will help:
> 
> http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/DisableAfterSubmit.js
>
>  Notice setSubmittingElement() call
> 
> 
> On May 12, 2012, at 10:45 AM, Arno Haase
> <ar...@haase-consulting.com> wrote:
> 
> It does, unfortunately.
> 
> When the form is initially rendered, Tapestry assigns it the id I 
> assign in the .tml file. On subsequent *AJAX* refreshs, Tapestry 
> appends some number to the initial id.
> 
> I have
> 
> <t:zone t:id="zone" id="zone" show="show" update="show"> <t:form
> t:id="dynamicForm" id="dynamicForm" zone="zone" autofocus="false">
> 
> ... </t:form> </t:zone>
> 
> in the .tml file, and a DOM inspection after an AJAX refresh of
> the zone shows
> 
> <div id="zone" class="t-zone tapestry-zone"> <form
> id="dynamicForm_13741814fec" class="t-prevent-submission" 
> method="post" action="/webbib/de/versesearch.dynamicform">
> 
> ...
> 
> </form> </div>
> 
> 
> 
> 
> Am 12.05.2012 17:17, schrieb Thiago H. de Paula Figueiredo:
>>>> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase 
>>>> <ar...@haase-consulting.com> wrote:
>>>> 
>>>>> So referencing the form by its ID is out, since the form
>>>>> is assigned a new and different ID after each AJAX zone
>>>>> refresh.
>>>> 
>>>> This won't happen if you give an explicit id (not t:id, id)
>>>> for the form.
>>>> 
>> 
>> ---------------------------------------------------------------------
>>
>> 
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
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+urNQACgkQbmZsMyUPuXTIpgCgjY/9UjnaDtRj0THpJXfHwphM
9RsAniYFQPJOabdyeHGrWd5iXFNrYQ34
=Ws5J
-----END PGP SIGNATURE-----

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


Re: referencing a form from JS

Posted by Lenny Primak <lp...@hope.nyc.ny.us>.
Perhaps this will help:

http://code.google.com/p/flowlogix/source/browse/tapestry-services/src/main/resources/com/flowlogix/web/mixins/DisableAfterSubmit.js

Notice setSubmittingElement() call


On May 12, 2012, at 10:45 AM, Arno Haase <ar...@haase-consulting.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> It does, unfortunately.
> 
> When the form is initially rendered, Tapestry assigns it the id I
> assign in the .tml file. On subsequent *AJAX* refreshs, Tapestry
> appends some number to the initial id.
> 
> I have
> 
> <t:zone t:id="zone" id="zone" show="show" update="show">
>  <t:form t:id="dynamicForm" id="dynamicForm" zone="zone"
>     autofocus="false">
> 
>  ...
>  </t:form>
> </t:zone>
> 
> in the .tml file, and a DOM inspection after an AJAX refresh of the
> zone shows
> 
> <div id="zone" class="t-zone tapestry-zone">
>  <form id="dynamicForm_13741814fec" class="t-prevent-submission"
>      method="post" action="/webbib/de/versesearch.dynamicform">
> 
>  ...
> 
>  </form>
> </div>
> 
> 
> 
> 
> Am 12.05.2012 17:17, schrieb Thiago H. de Paula Figueiredo:
>> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase 
>> <ar...@haase-consulting.com> wrote:
>> 
>>> So referencing the form by its ID is out, since the form is
>>> assigned a new and different ID after each AJAX zone refresh.
>> 
>> This won't happen if you give an explicit id (not t:id, id) for the
>> form.
>> 
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAk+uhagACgkQbmZsMyUPuXSQAACfVqA6b1xznOhFejgcFAa0YK5U
> oCEAoIItYMBqHRPjk4fwfgmDHW1T3dzB
> =ron1
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> 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: referencing a form from JS

Posted by Arno Haase <ar...@haase-consulting.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It does, unfortunately.

When the form is initially rendered, Tapestry assigns it the id I
assign in the .tml file. On subsequent *AJAX* refreshs, Tapestry
appends some number to the initial id.

I have

<t:zone t:id="zone" id="zone" show="show" update="show">
  <t:form t:id="dynamicForm" id="dynamicForm" zone="zone"
     autofocus="false">

  ...
  </t:form>
</t:zone>

in the .tml file, and a DOM inspection after an AJAX refresh of the
zone shows

<div id="zone" class="t-zone tapestry-zone">
  <form id="dynamicForm_13741814fec" class="t-prevent-submission"
      method="post" action="/webbib/de/versesearch.dynamicform">

  ...

  </form>
</div>




Am 12.05.2012 17:17, schrieb Thiago H. de Paula Figueiredo:
> On Sat, 12 May 2012 11:59:42 -0300, Arno Haase 
> <ar...@haase-consulting.com> wrote:
> 
>> So referencing the form by its ID is out, since the form is
>> assigned a new and different ID after each AJAX zone refresh.
> 
> This won't happen if you give an explicit id (not t:id, id) for the
> form.
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+uhagACgkQbmZsMyUPuXSQAACfVqA6b1xznOhFejgcFAa0YK5U
oCEAoIItYMBqHRPjk4fwfgmDHW1T3dzB
=ron1
-----END PGP SIGNATURE-----

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


Re: referencing a form from JS

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Sat, 12 May 2012 11:59:42 -0300, Arno Haase  
<ar...@haase-consulting.com> wrote:

> So referencing the form by its ID is out, since the form is assigned a
> new and different ID after each AJAX zone refresh.

This won't happen if you give an explicit id (not t:id, id) for the form.

-- 
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