(@Walter: They're in separate forms; he's probably only submitting one of them.)
Hi, Prototype's $() function relies on the underlying browser's implementation of the DOM standard function document.getElementById. IE6's implementation of document.getElementById is broken: It returns the first element whose 'id' *or* 'name' matches the given string. This is true even in IE7, even when you're not in quirks mode. Shocking, I know. I'd suggest using IDs that don't overlap with names. That allows you to keep using the same name for both fields in the two different forms, without causing this ID confusion. HTH, -- T.J. Crowder tj / crowder software / com Independent Software Engineer, consulting services available On Jan 24, 9:55 am, silverweb <[email protected]> wrote: > I worked on user management scripts and everything was working like a > charm on FireFox, so I went to try it on IE6. And I had strange errors > or no effects at all when validating password on some form. > > After some researching, I found I had two quite similar fields in two > different forms: > > <input name="passwd" type="password" id="loginPasswd" /> > > and few lines forward in second form: > > <input name="passwd" type="password" id="passwd" /> > > When I wanted to work on the second field (id=passwd) I had strange > outputs on IE6, so I did: > > alert($('passwd').inspect()); > > and I got an answer about <input name="passwd" id="loginPasswd" /> ... > > In FireFox, everything was OK. So it looked like in IE6 when we want > to get a field by ID, $() function works on name attribute, not on id > attribute. > > I did a test, and renamed the first password field (id="loginPasswd"): > > <input name="loginPasswd" type="password" id="loginPasswd" /> > > and now after alert($('passwd').inspect()) I got the correct answer. > > I think there's something wrong with $() function on IE6... > > A workaround for this problem (I wanted to leave the name attributes, > to be the same name) was to add some unique class name to the input > field, and then work on object got not by $('passwd') function but > something like: > > $('formName').down('.uniqueClassNameForPasswd') > > What do you think? > > Greetz, > Adam --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
