View Single Post
Old 05-16-2008, 08:46 PM   PM User | #7
weazil
New to the CF scene

 
Join Date: Apr 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
weazil is an unknown quantity at this point
Thanks man that makes it editable again... the only downside is now if there was data there it drops you to a input box with undefined in it instead of the original text.

FIXXED....
it was missing the return piece.... figured it out and maybe this will help someone else out.

getText: function() {
this.element.getElementsBySelector('.'+this.options.emptyClassName).invoke('remove');
return this.__getText();
},

Quote:
Originally Posted by GJay View Post
wrap the getElementsByClassName function with $A().

or replace the whole lot with:
Code:
getText: function() {
  this.element.getElementsBySelector('.'+this.options.emptyClassName).invoke('remove');
}
The result of the getElsByClass isn't actually an array (it just acts a lot like one...), and so the Prototype extensions (.each and so on) aren't added to it. getElementsBySelector takes a CSS rule, so add a '.' to the front for a classname-restriction and returns an actual array of prototype-extended elements. Rather than removing the element from it's parent explicity, prototype gives you a 'remove()' method on elements, and by using 'invoke' you remove the need for an anonymous function.
weazil is offline   Reply With Quote