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.ha...@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 >>> <arno.ha...@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 >>>>>> <arno.ha...@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-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 >>> >>> >> -----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-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >>