Thanks Andreas. Yes, name attribute was the problem. I've changed to using getElementById and it's working again.
c. -----Original Message----- From: andre...@gmail.com [mailto:andre...@gmail.com] On Behalf Of Andreas Andreou Sent: 16 December 2010 10:12 To: Tapestry users Subject: Re: T5: Javascript problem I dont like this way of refering to nodes ( document.entryForm.oosComment ) i'm not sure how many browsers fully support this but it looks like this can work when nodes have the name attribute set. If i remember correctly, T5.1 used to include a name in each form but this was removed in 5.2 - see https://issues.apache.org/jira/browse/TAP5-796 So, anyway, see if your nodes have id, and just reference them in that way using either document.getElementById or prototype's $$ On Thu, Dec 16, 2010 at 10:51, Newham, Cameron <cameron.new...@bl.uk> wrote: > Hi! > > > > Another simple question. > > > > I had an application running under T5.1 and I've now moved to 5.2. I > notice my Javascript is now broken. I have this function in my .tml > file: > > > > <SCRIPT type="text/JavaScript" LANGUAGE="JavaScript"> > > > > function checkOOS(myCheck) > > { > > if(myCheck.checked) > > { > > document.entryForm.oosComment.disabled = false; > > document.entryForm.oosComment.focus(); > > } > > else > > { > > document.entryForm.oosComment.disabled = true; > > } > > } > > > > </SCRIPT> > > > > Which turns a select on and off by clicking a checkbox via onclick. > While the JavaScript function is called, it no longer updates the > disabled attribute of oosComment. > > > > Should I be adding my JavaScript with JavaScriptSupport (and if so, > where is documentation or an example? The only mention of JavaScript I > can find is in the HOW-TOs which show it being added to the .tml file > directly in a script block). > > > > Also, why is this now partially non-functioning in 5.2? It seems that > document.entryForm.oosComment.disabled is incorrect for referring to > component oosComment. Yet this works fine under 5.1. My Form is called > "entryForm" and oosComment is inside that. The page hasn't changed since > it worked under 5.1 but, in that case, it seems I've been doing > something wrong all along even though it worked. > > > > c. > > > > -- Andreas Andreou - andy...@apache.org - http://blog.andyhot.gr Tapestry PMC / Tacos developer Open Source / JEE Consulting --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org