here some ugly code sequences hope that helps example javascript class (SelectSwapper.js)
var SelectSwapper = Class.create(); SelectSwapper.prototype = { initialize: function(selectComponentId, linkId) { this.selectComponent = selectComponentId; this.linkId = linkId; this.selectedValue = ""; Event.observe($(this.selectComponent), 'change', this._change.bindAsEventListener(this)); Event.observe($(this.linkId), 'click', this._click.bindAsEventListener(this)); }, _change: function(myEvent) { this.selectedValue = $F(this.selectComponent).trim(); }, _click: function(myEvent) { if (this.selectedValue.length() > 0) { $$('.Artifact-type-').each(function show(object){object.style.display='block';}); $$('.Artifact-type-TASK').each(function show(object){object.style.display='block';}); $$('.Artifact-type-PERS').each(function show(object){object.style.display='none';}); $$('.Artifact-type-LEAR').each(function show(object){object.style.display='none';}); } } } than add this to you page/component class @IncludeJavaScriptLibrary(value = {"SelectSwapper.js"}) public class BlaBlaBla { @Environmental private RenderSupport _renderSupport; @Component private Select mySelect; @Component(parameters = {"element=a", "href=literal:#"}) private Any myLink; void afterRender(MarkupWriter writer) { _renderSupport.addScript("new SelectSwapper('%s', '%s')", mySelect.getClientId(), myLink.getClientId()); } } 2008/6/25 Joachim Van der Auwera <[EMAIL PROTECTED]>: > Ok template (layout) starts like this : > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> > <head> > <link rel="stylesheet" type="text/css" href=" > http://yui.yahooapis.com/2.4.0/build/reset/reset-min.css" /> > <title><t:delegate to="title"/></title> > <link rel="shortcut icon" href="${favicon}" type="image/x-icon" /> > <link type="text/css" rel="stylesheet" href="${style}" /> > <script src="${prototypeJs}" type="text/javascript" /> > <style id="applicationStyles"></style> > </head> > > Where the layout class includes > > @Inject > @Path( "${tapestry.scriptaculous}/prototype.js" ) > private Asset prototypeJs; > > The page contains some select components with onclick code like the > following > > > onchange="$(('Show-Artifact-type-'+this.options[this.selectedIndex].value).trim()).onclick();" > > > One of these objects on which the onclick is invoked look like this : > > <a href="javascript:;" id="Show-Artifact-type-TASK" onclick=" > $$('.Artifact-type-').each(function > show(object){object.style.display='block';}); > $$('.Artifact-type-TASK').each(function > show(object){object.style.display='block';}); > $$('.Artifact-type-PERS').each(function > show(object){object.style.display='none';}); > $$('.Artifact-type-LEAR').each(function > show(object){object.style.display='none';}); > ">TASK</a> > > > > Thanks for your help. > > > Joachim > > > > Sven Homburg wrote: > >> please share i bit more code around your problem >> tml and js snippet should help >> >> 2008/6/24 Joachim Van der Auwera <[EMAIL PROTECTED]>: >> >> >> >>> Thanks Sven, but what exactly are you referring to? >>> >>> If you are referring to the use of RenderSupport for javascript, then I >>> should explain a bit. >>> >>> I have already had to make various changes in my Layout classes etc to >>> assure they work with the move of the javascript to the bottom of the >>> page. >>> The last problem I faced was that the onchange on some of my select items >>> use prototype and were run (causing javascript errors in IE) before >>> prototype.js is loaded. To fix that, I explicitly refer to prototype in >>> "<head>" section in my Layout class. I know this results in prototype >>> being >>> included twice, but I don't know of a way to fix this as I seem to have a >>> chicken and egg problem here. >>> >>> Thanks for the help, >>> Joachim >>> >>> >>> Sven Homburg wrote: >>> >>> >>> >>>> please read >>>> http://tapestry.apache.org/news.html#Tapestry%205.0.13 >>>> >>>> >>>> >>>> >>> 2008/6/23 Joachim Van der Auwera <[EMAIL PROTECTED]>: >>> >>> >>>> >>>> >>>> >>>>> Hi, >>>>> >>>>> after upgrade of my application to tapestry 5.0.13 I get a "unknown >>>>> runtime >>>>> error" on loading the page in IE. >>>>> >>>>> This is reported at line 2403 of prototype.js on the line >>>>> "else element.innerHTML = content.stripScripts()" >>>>> >>>>> Does anybody have any idea how this problem can be remedied? >>>>> >>>>> Kind regards, >>>>> Joachim >>>>> >>>>> -- >>>>> Joachim Van der Auwera >>>>> PROGS bvba, progs.be >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>>> >>> -- >>> Joachim Van der Auwera >>> PROGS bvba, progs.be >>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >>> >>> >> >> >> >> > > > -- > Joachim Van der Auwera > PROGS bvba, progs.be > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- with regards Sven Homburg http://tapestry5-components.googlecode.com http://chenillekit.googlecode.com