If you're programmically building the javascript, you can just output
component.getClientId(FacesContext) and it'll generate the
fully-qualified id for you.
You can get a reference to "component" by binding it to your backing bean.

I don't understand your comment about a gap between JSF and MyFaces.  
MyFaces is a JSF implementation.   Any gaps would be a bug.

On 12/12/05, Steve Ivy <[EMAIL PROTECTED]> wrote:
> Thanks all,
>
> I've looked at forceId, and it looks like it will do what I'm looking
> for in a limited context. However, there appears to be a gap in api
> coverage between JSF and myfaces: JSF provide tags for things like
> form labels, spans (via outputText) etc, but these elements inherit
> the namingContainer behavior, which I'm trying to override.
>
> Tomahawk provides forceId for all its custom components, but has no
> equivalent way to output the kinds of tags I need. Tomahawk *does*
> provide htmlTag, but it's a very limited component that does not
> appear to provide for any attributes other than the tag name (via
> htmltag's _value_ attribute) so I cannot use it for any tag that
> requires oather attributes to be set (like label's _for_ attribute or
> the _title_ attribute).
>
> I'm not sure where to go from here, to be honest.
>
> --Steve
>
> On 12/12/05, Werner Punz <[EMAIL PROTECTED]> wrote:
> > Steve Ivy wrote:
> > > Hello,
> > >
> > > I'm working on the front end for a JSF app, and I'm trying to add some
> > > interactivitiy to the interface via javascript. Typically you do a lot
> > > of:
> > >
> > > document.getElementById ('someId').etc ()
> > >
> > > But I find that setting the id in JSF usually results in something
> > > like id="content:_id35:nameHelp". I'm not sure how these ids are
> > > assigned, and I'm not sure how I can predict what id an element will
> > > have in order to acess it via javascript (or css for that matter, but
> > > that's another rant). Are there accepted methods of getting around
> > > this?
> > >
> >
> > the ids usually are assigned by nesting hierarchy, if you use the ids
> > explicitely you basically get the nested elements divided by :
> > ie.:
> > view id="viewid"
> > form id="myform"
> > element id="element"
> >
> > results in an id for the element of viewid:myform:element
> >
> > however myfaces has something much easier in the tomahawk components,
> > you can use the forceid attribute then with following
> > element id="element" forceid="true" you get an exact form id of element
> > for your element
> >
> >
>
>
> --
> Steve Ivy
> http://redmonk.net
>

Reply via email to