Hey all! I'm sorry, but I've been butting up against this for a day
and a half now, and I'm exhausted. It seems simple.
Basically, I'm trying to use the WebKit "contenteditable" attribute to
create a smallish front end for a database... so what I did was put a
few divs on the page and then passing their IDs to a class, which has,
amongst other functions, load()... well, here it is:
var fp_EditField = Class.create({
initialize: function(el) {
Object.extend(this,el);
},
load: function() {
alert(('check #1: ' + this.id);
new Ajax.Updater(this,'loader.php',{parameters: {field:
this.id}, onComplete: function(){
alert('check #2: ' + this.innerHTML);
}
});
},
...etc.
and some regular old HTML:
<div id="article_title" contenteditable="true"><p>Just some average
HTML in here!</p></div>
and then inside Event.observe(window,'load'...):
$$('[contenteditable=true]').each(function(el) {
var ef = new fp_EditField(el);
ef.load();
});
Now, for starters, is that a ridiculous way to pass that pre-existing
HTML to my class? With that Object.extend(this,el) call? And then
also iterating through all the contenteditable DIVs... using the same
ef for each of them is surely a mistake...
And further... an earlier version of my code (before I was using
onComplete), the innerHTML was being reported as being the same as it
was before the Ajax call. Now, however, Check #1 is giving me the ID
of the DIV, and Check #2 is undefined.
Can somebody set me straight? I hope I'm being clear, I'm feeling
REALLY cloudy about this right now. I feel like I've explored so many
avenues that I can't keep them straight anymore. I've tried things
like Element.update() but it seems like perhaps there is a disconnect
between the actual instance of the DIV and the one that I'm trying to
operate on...
Ok! Thanks in advance!
Ian R
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---