On Jan 8, 4:09 am, SGD <[email protected]> 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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to