Thanks! I have no idea why earlier versions of Prototype worked with this, yet an upgrade to 1.7 broke it. What you said makes complete sense (in regards to IE anyway). I just wish it broke when I had originally wrote it. :) Regardless, now that I know it's an easy fix we'll be able to upgrade to 1.7 soon. :)
Thanks a lot for your help! On Apr 8, 12:39 pm, "T.J. Crowder" <[email protected]> wrote: > Hi, > > It fails because you never extend the checkbox element, just the form. > On IE, you have to explicitly extend individual elements, Prototype > can't do it at the prototype level because IE doesn't allow it. > (Prototype extends elements at the prototype level, rather than > individually, in just about every other browser.) More > here:http://prototypejs.org/learn/extensions > > So your code will work reliably if you extend the element: > > document.observe('dom:loaded', function() { > var elm = $('form-on-fails'); > var checkbox = $(elm['test']); // extend it > alert(checkbox); // object > alert(checkbox.setValue); // function > > }); > > Live examples:http://jsbin.com/ojali3- the code > abovehttp://jsbin.com/ojali3/2- demonstrating it before (fails on IE) and > after > > This is not new behavior, this is how Prototype has worked for years; > perhaps always, I wouldn't know in the pre-1.6 years. For instance, > here with 1.6.1:http://jsbin.com/ojali3/3 > > Note that once a specific element has been extended *once*, it stays > extended until/unless it's torn down. So for instance, this works, > even on IE: > > document.observe('dom:loaded', function() { > var elm = $('form-on-fails'); > $(elm['test']); // extend the element > alert(elm['test']); // object > alert(elm['test'].setValue); // function > > }); > > http://jsbin.com/ojali3/4 > > ...so when you've done this before, directly accessing form elements > without extending them at that particular time, perhaps you'd already > extended them earlier or something. > > HTH, > -- > T.J. Crowder > Independent Software Engineer > tj / crowder software / com > www / crowder software / com > > On Apr 8, 3:37 pm, Justin Osborne <[email protected]> wrote: > > > > > > > > > I have a test case of something that works in every browser except for > > IE (testing with IE6-9, but I've seen it work with 9 before) when > > using Prototype 1.7. We tried upgrading to 1.7 this week and it broke > > some of our sites because I've used this often in the past with > > Prototype 1.6 (thus, we had to go back to 1.6). I don't like assign > > IDs to every form element when you can get them by their name. Is this > > a bug or something I'm doing wrong? > > >http://www.eblah.com/justin/breakable.html > > > You should get two alert popups. One should say object (it's the form > > element) and the other should show: > > > function () { > > var a = update([this], arguments); > > return __method.apply(null, a); > > > } > > > In IE you'll get the first popup, but the second one will be > > "undefined". It's like Prototype isn't completely extending the DOM as > > it used to in Prototype 1.6. -- You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
