You can pass it an element reference, however your reference of "this"
isn't an element.  It may have assumed element methods via
Object.extend in your constructor but the reference is still to a
function, not a DOM reference.


--

http://positionabsolute.net



On Jan 8, 12:04 pm, Ian R <i...@fairmountfair.com> wrote:
> On Jan 8, 4:09 am, SGD <danny.g...@googlemail.com> wrote:
>
> > Try new Ajax.Updater(this.id, as you have to pass the id of an
> > element, not the element itself.
>
> Oh!  I thought you could pass either the ID or an element reference...
> in fact, the code seems to work either way, so maybe that's true.
>
>
>
> > You can optimize your code by just having:
>
> > $$('[contenteditable=true]').each(function(el) {
>
> > new Ajax.Updater(el.id,'loader.php',{parameters: {field:
> > el.id}, onComplete: function(){
> >        alert('check #2: ' + el.innerHTML);
> >       }
> >       });
> >   });
>
> This works really well, and thank you, but I have a need to call this
> function in multiple places (like, both on page load and on a button
> click, and maybe some other places)... which is not a problem, I've
> taken the meat of it out and placed it in a function called load(el),
> and I'm calling that function in this loop and I can call it
> elsewhere, and I can continue from here in this realm.
>
> However, what I *thought* I was trying to do was develop my
> "editfield" as an object, add the appropriate properties and methods
> and things, and then call these functions as el.load() rather than load
> (el).  I suppose there is not a ton of benefit from this, other than
> to increase my fluency with OOP and to allow for subclassing and
> method overriding.
>
> I would really like to know more about this, though, and in particular
> how one can take existing HTML (like my DIVs) and "apply" such an
> object to it... the example that I keep coming back to is how one can
> take an existing UL and say:
>
>         Sortable.create(el);
>
> And then that UL has methods and properties of a Sortable.  HOWEVER: I
> would like to have an instance which I can call in events.
>
> Once again, I have talked myself dizzy and I'm not quite sure what I'm
> saying anymore.  If any of this makes sense, I would love to be
> directed to some sort of document that I could read on the subject, or
> if anyone could advise me on a decent search string, I have been
> looking this up but I am not 100% sure I'm using the correct terms.
>
> Thanks so much!  I am very excited about Prototype!  I didn't realize
> how much I liked it until I started messing around with Dojo.
> Prototype makes a lot more sense to me, personally.
>
> Ian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to