>From: "Martin Marinschek" <[EMAIL PROTECTED]>
>
> Wait a minute - will this work if the script itself is embedded in a panelGrid?
>
 
We ran into these issues with Shale's commons validator.  The Shale commons validator adds the _javascript_ to the bottom of the page.  There is one "ValidatorScript" component that adds the _javascript_ by looking at the component tree.  This is done after rendering the components. 
 
To handle the UIData heritage of components, we decorate the RenderKit that in turn decorates renderers of the javax.faces.Input family.   
 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/faces/ValidatorRenderKit.java?view=markup
 
 
The renderer decorators captures the clientId's before renderering and saves them into an attribute of the component (a Map).  They also evaluate EL that might be specific to the data model row.  The component now has a state table of the client Id's and ValueBinding attributes at renderering. 
 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/renderer/ValidatorInputRenderer.java?view=log
 
The ValidatorScript component uses this extra state, if available, when generating the _javascript_. 
 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/component/ValidatorScript.java?view=markup
 
 
We also use this renderer decorator trick to inject _javascript_ into the onclick event of command's that have the immediate property turned on.  This bypasses client side _javascript_ for a limited set of the command family of components.
 
http://svn.apache.org/viewvc/shale/framework/trunk/shale-core/src/main/java/org/apache/shale/renderer/ValidatorCommandRenderer.java?view=log
 
 
 
> regards,
>
> Martin
>
Gary
 
> On 8/23/06, Mario Ivankovits <[EMAIL PROTECTED]>wrote:
> > Hi!
> >
> > Sometimes one would like to embedd the clientId of a component into a
> > custom _javascript_ (maybe like me now).
> >
> > So instead of using forceId= and a script like:
> >
> >
> > var button=document.getElementById("abc");
> >

> >
> > I though having a clientId tag would be nice, then the above will be
> >
> >
> > var button=document.getElementById("");
> >

> >
> > s:clientId simply tries to find the component pointed to with "for" and
> > outputs its client id.
> >
> > Later (JSF 1.2) when we have access to the content-body (I heard this
> & gt; sh ould be possible) we might also be able to directly use some embedded
> > el or whatever, bot for now this could do the trick too - and its a
> > rather simple tag, no?
> >
> > What do you think?
> >
> > Ciao,
> > Mario
> >
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces

Reply via email to