[Proto-Scripty] Re: onChange in Dynamic Element not working in IE6
Thank you both for your responses. I have found a workaround for my problem. This really drove me crazy though the solution is not that complicated. I’m going to be somewhat long winded so others do not have to go through this. I know that calling events from within html is discouraged, my story is probably another reason not to do this. First of all, onchange and onbur do not not work as attributes in IE6 for create elements. For example: var newSecurityInput = new Element('input', {'type':'text','class':'text newid', 'name':'newid', 'onChange': validateNewSecurityChange(this); ,'onBlur': getSecurityName (this);}); I ended up taking a similar approach as you did for adding class attributes, I added it after the creation of the element. var newSecurityInput = new Element('input', {'type':'text', 'class':'text newid', 'name':'newid'}); Event.observe(newSecurityInput,'change',validateNewSecurityChange); Event.observe(newSecurityInput,'blur',getSecurityName); My problem was compounded because I had inline html that already called this function, and passed ‘this’ to it td class=text input type=text id=newid1 class=text name=newid1 onChange=validateNewSecurityChange (this); onBlur=getSecurityName(this); / The function looked like this function getSecurityName (obj) { var securityId = $F(obj); This had been working fine. I created a new function for the new create element event that looks like this. function getSecurityName() { var securityId = $F(this); This did not work as both call went to the same function. What I had to do was create a function with a different name for the inline html function getSecurityNameNoBind(obj) { var securityId = $F(obj); td class=text input type=text id=newid1 class=text name=newid1 onChange=validateNewSecurityChangeNoBind (this); onBlur=getSecurityName(this); / I’m still a little confused over why I had to do this but it works. --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: onChange in Dynamic Element not working in IE6
Just as a side measure that you are probably not aware of... IE8 has a bug that when you do your new Element(td..,'class':'text'... It will not add the class to IE8 browsers ... you need to use addClassName('text'); after you insert it... I found this out the hard way ! Alex Mcauley http://www.thevacancymarket.com - Original Message - From: molo maurice_lowent...@ssga.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, October 26, 2009 7:27 PM Subject: [Proto-Scripty] onChange in Dynamic Element not working in IE6 The following code works in Firefox but the onChange/onBlur events do not get triggered from the browser in IE6 Does anyone know 1) How to fix this 2) If I should use a different approach for dynamically building the form elements I dynamically build elements on the screen base on a button being entered to call a function var newSecurityTdInput = new Element('td' , {'class':'text'}); var newSecurityInput = new Element('input', {'type':'text', 'class':'text newid', 'name':'newid', 'onChange': validateNewSecurityChange(this); ,'onBlur': getSecurityName (this);}); newSecurityTdInput.appendChild(newSecurityInput); newSecurityTr.appendChild(newSecurityTdInput); Thanks --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: onChange in Dynamic Element not working in IE6
This one was a SOB and as always, IE is at fault... Here is what I found on researching this... now this is for IE only of course.. var cell = new Element(td); This is all well and good w/o any attributes, the Element constructor delegates the attributes object, the second parameter to Element.writeAttribute... cell.writeAttribute(class, text); fails to work due to the attribute translations, found in the Element._attributeTranslations.write object. IE8 is now expecting to write to the literal class attribute, not the className that it gets translated to. cell.setAttribute(class, text); //this works fine in IE8 cell.addClassName(text); //this also works but its not using element attributes but the JS DOM reference itself, ie cell.className = ... -- http://positionabsolute.net On Oct 26, 4:04 pm, Alex McAuley webmas...@thecarmarketplace.com wrote: Just as a side measure that you are probably not aware of... IE8 has a bug that when you do your new Element(td..,'class':'text'... It will not add the class to IE8 browsers ... you need to use addClassName('text'); after you insert it... I found this out the hard way ! Alex Mcauleyhttp://www.thevacancymarket.com - Original Message - From: molo maurice_lowent...@ssga.com To: Prototype script.aculo.us prototype-scriptaculous@googlegroups.com Sent: Monday, October 26, 2009 7:27 PM Subject: [Proto-Scripty] onChange in Dynamic Element not working in IE6 The following code works in Firefox but the onChange/onBlur events do not get triggered from the browser in IE6 Does anyone know 1) How to fix this 2) If I should use a different approach for dynamically building the form elements I dynamically build elements on the screen base on a button being entered to call a function var newSecurityTdInput = new Element('td' , {'class':'text'}); var newSecurityInput = new Element('input', {'type':'text', 'class':'text newid', 'name':'newid', 'onChange': validateNewSecurityChange(this); ,'onBlur': getSecurityName (this);}); newSecurityTdInput.appendChild(newSecurityInput); newSecurityTr.appendChild(newSecurityTdInput); Thanks --~--~-~--~~~---~--~~ 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 prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---