View Single Post
Old 04-09-2008, 06:54 PM   PM User | #2
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
Quote:
Originally Posted by spetsacdc View Post
Hi, I am simply trying to implement the ajax in place editor system with scriptaculous.

http://wiki.script.aculo.us/scriptac....InPlaceEditor

Its easy to install the script and everything, but I am trying to do the extra part he talks about at the bottom:

Small extension to editor to add a text in case field is empty.

Now, I have everything working, but if you click the "click to edit..." thing that the extension adds to an empty field, then click cancel, the field goes blank instead of back to "click to edit..." so the user can't edit it unless he refreshes the page. Is this a bug? Anyone know how to edit the script to call the if empty function when they click cancel?

Thanks
I've been toying with a fix for it, basically what it looks like is back in the summer from 1.6 - 1.8 InplaceEditor was completely rewrote.... onComplete is no longer called when you leave the field so it never checks to see if its empty.

If you change the code to read

FROM
Ajax.InPlaceEditor.prototype.__onComplete = Ajax.InPlaceEditor.prototype.onComplete;
TO
Ajax.InPlaceEditor.prototype.__onComplete = Ajax.InPlaceEditor.prototype.leaveEditMode;

and

FROM
onComplete: function(transport){
TO
leaveEditMode: function(transport){

... if you do an alert inside the leaveEditMode you can see now it will kick off.. but I can't figure out for the life of me when it comes back.... this.element.innerHTML.length it equals 2... and if you alert this.element.innerHTML it comes back with %OA%OA and thats where i'm stuck unsure what OA is... i can cheat and tell it to check to see if the length is 0 or 2... and it will put the click to edit back.. but what happens whe your field actually only has 2 characters in it
weazil is offline   Reply With Quote