pageRenderSupport.addScript("new Test(wellType);"); I'm not surprised that IE8 fails, but that FF3 works; in fact, there's probably an error in the FF3 console. What is the value of variable wellType? It's undefined.
On Wed, Apr 22, 2009 at 7:15 AM, olip <oliverp...@googlemail.com> wrote: > > Hi everyone! > > The following code works fine under Firefox3 but not under IE8. > > I made a little component where I build up a drop down menue and a > javascript section which should access the components id element. > > ==================== > Test.java (a component): > > > @IncludeJavaScriptLibrary(value = {"Test.js"}) > public class Test { > > �...@inject > private ComponentResources resources; > �...@environmental > private RenderSupport pageRenderSupport; > > > �...@beginrender > public void graph(MarkupWriter writer){ > //Method selection..make a drop down menue > writer.write("Choose a wellType: "); > //make a selection - drop down box > writer.element("form","name","listColors"); > writer.element("select","id","wellType","name","WellType"); > //the value will be the html color we will paint the table element > with when clicking at a specific well > > writer.element("option","value","positive","selected","selected"); > writer.write("positive"); > writer.end(); > writer.element("option","value","negative"); > writer.write("negative"); > writer.end(); > writer.element("option","value","other"); > writer.write("other"); > writer.end(); > writer.element("option","value","contaminated"); > writer.write("contaminated"); > writer.end(); > > //end of selectionBox div > writer.end(); > //end of form > writer.end(); > } > void afterRender(MarkupWriter writer){ > > //javascript will send the name of the clicked well names later to > this java class back (see onreceiveWellID method) > Link link = resources.createEventLink("receiveWellID"); > pageRenderSupport.addScript("new Test(wellType);"); > } > > > } > > ==================== > Therefore I made a small javascript file: > > > Test.js: > > var Test = Class.create(); > Test.prototype = { > > > initialize: function(wellType) { > alert(wellType.value); > } > } > > > ==================== > A small test page: > > > TestComponent.tml > > <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> > <head> > <title>Tapestry 5 Demo Application</title> > </head> > <body> > <t:Test/> > </body> > </html> > > > > ==================== > > Now if I am using this component everything works fine under FF3 but under > IE8 I got the message that the 'wellType' is undefined. > But if I look into the html generated code I can see that the select tags > are before the javascript so it should find the element id. > > Is this a bug in Explorer8. > > > Thanks for your help. > > Oliver > > -- > View this message in context: > http://n2.nabble.com/IE-8-and-Javascript-Rendersupport.addScript%28%29-problem-tp2676456p2676456.html > Sent from the Tapestry Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry Director of Open Source Technology at Formos --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org