On Mon, Nov 17, 2008 at 10:24 AM, Peter Stavrinides <
[EMAIL PROTECTED]> wrote:

> This should be as straightforward as this:
>
> <t:select t:id="addTo" id="addSelect" model="playlistNames"
>  blankOption="NEVER" value="selectedPlaylist"/>
>
> //gets the object on the client
> var selectList = document.getElementById("addSelect");
>


I ran into this same problem a while back.  It was very frustrating, I
believe it's because you are updating using a zone or another XHR call, so
even though your component is only rendered once, it's rendered multiple
times without a full page refresh, which is why tapestry adds the uniquifier
(not a real word).  There were two workaround proposed at the time (search
the list), one is a modified getElementById which searches for the prefix
(your original id), but this was too slow for my tastes, I instead now use
getElementbyId on something outside of the ajax updated stuff, then get the
appropriate select by type (this isn't very refactor friendly but worked
well enough for me).  If the above code works (can't test it myself right
now, but I think I tried that before and it didn't work as I wanted) then it
would be much more elegant.  IIRC it instead overwrites your id="" with the
unique t:id
Steve



>
>
>
> ----- Original Message -----
> From: "Gabriel Rodriguez" <[EMAIL PROTECTED]>
> To: "Tapestry users" <users@tapestry.apache.org>
> Sent: Monday, 17 November, 2008 6:00:50 PM GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> Subject: RE: unique ids for a select boxes
>
>
> If I remember correctly, this will happen if you're creating more than
> one instance of it per page. Any id should be unique and Tapestry will
> help you achieve this whether you want it to or not. Anything else is
> bad form.
>
> -----Original Message-----
> From: Chris Hannam [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 17, 2008 8:58 AM
> To: Tapestry users
> Subject: Re: unique ids for a select boxes
>
> Hi,
> Its gets stranger. That works for the first time I visit the page. The
> select box has the correct name. When I revisit the page the id has
> changed
> to :
>
> <select id="addTo:11dab2a7236" name="addTo">
>
> From:
> <select id="addTo" name="addTo">
>
> Any ideas why?
>
> CH
>
> On Mon, Nov 17, 2008 at 3:31 PM, Gabriel Rodriguez <
> [EMAIL PROTECTED]> wrote:
>
> >
> > Try this:
> >
> > <t:select id="addTo" clientId="addTo" model="playlistNames"
> > blankOption="NEVER" value="selectedPlaylist"/>
> >
> > -----Original Message-----
> > From: Chris Hannam [mailto:[EMAIL PROTECTED]
> > Sent: Monday, November 17, 2008 8:26 AM
> > To: Tapestry users
> > Subject: Re: unique ids for a select boxes
> >
> > Yes, it sets a unique id on the name e.g. select:12o34nkasi98
> >
> > I need to know the id to access the select box.
> >
> > CH
> >
> > On Mon, Nov 17, 2008 at 3:21 PM, Gabriel Rodriguez <
> > [EMAIL PROTECTED]> wrote:
> >
> > >
> > > Have you tried setting the clientId property?
> > >
> > > -----Original Message-----
> > > From: Chris Hannam [mailto:[EMAIL PROTECTED]
> > > Sent: Monday, November 17, 2008 8:11 AM
> > > To: users@tapestry.apache.org
> > > Subject: unique ids for a select boxes
> > >
> > > Hi,
> > > I`m trying to find the id of a select component from the following
> > .tml
> > > file:
> > >
> > > <t:select id="addTo" model="playlistNames" blankOption="NEVER"
> > > value="selectedPlaylist"/>
> > >
> > > The tapestry generated id when rendered in the browser has a unique
> > > identifier e.g. select:11daaf3019f  when means I cant access the
> > select
> > > box
> > > from my javascript.
> > >
> > > Can anyone point me in the right direction?
> > >
> > > CH
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to