You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by buckofive <kl...@yahoo.com> on 2008/04/23 00:08:22 UTC

T5: ajax component ids with namespaces

Hi All,

I recently updated to Tapestry 5.0.11 from 5.0.10 and unfortunately my
custom javascript calls are broken because component id's returned from ajax
calls now have a ":#####" next to them.  For example when I try to get a
reference to an object say $('foo') it doesn't exist because it is now
$('foo:12234') and this id changes on every ajax refresh.    I read the post
from Howard about this being a namespace for ajax requests
(http://thread.gmane.org/gmane.comp.java.tapestry.user/59677/focus=59697)
but I'm a little confused as to how I get access to these nodes with scripts
now? Can the AJAX namespacing be turned off (globally or at the component
level)?  Does anyone have a workaround for this?  

Much thanks in adavanced,
B

-- 
View this message in context: http://www.nabble.com/T5%3A-ajax-component-ids-with-namespaces-tp16826268p16826268.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: T5: ajax component ids with namespaces

Posted by buckofive <kl...@yahoo.com>.

After fiddling with protoype the $$ coupled with the !^ selector seems to
work.  I'm including some custom helper code to accomplish getting an
element by id without regard to the tapestry id namespace.  If this is/was
obvious or there is better solution, I apologize but hopefully this will be
helpful to others.

// gets the first element where the id begins with the 'id_starts_with'
argument.
function $G(id_starts_with)
{
	return( $G_(id_starts_with)[0] );
}

// gets all elements where their id's begin with the 'id_starts_with'
argument.
function $G_(id_starts_with)
{
	return( $$("[id^='"+id_starts_with+"']") );
}


to get access to this T5 namespaced node : 
   <form id="foo:1234" />
call
    $G('foo')


cheers,
B
-- 
View this message in context: http://www.nabble.com/T5%3A-ajax-component-ids-with-namespaces-tp16826268p16908236.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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