Tue 27 Nov 2007 at 9:32:33 pmWelcome To EditInPlace.org and Version 0.5.0
Thanks for visiting the new editinplace.org. Along with the new site there is a new version of the Edit In Place code, 0.5.0. There changes from previous versions so be sure to check out the documentation. I’m also trying out Vanilla for forums, so give that a whirl if you have questions and let me know what you think.
The fully commented code for version 0.5.0 comes in at 13,464 bytes and after minification is down to 8,507 bytes.
November 28th, 2007 at 9:52 am
hey Joseph, can we see an example before download (or did I miss it here somewhere)?
November 28th, 2007 at 12:10 pm
I hate to say it, but I completely forgot. For now you can checkout the example.html that comes with the release:
http://release.editinplace.org/latest/example.html
November 28th, 2007 at 9:16 pm
Hi Joseph, well done, that’s awesome! I’m just about to try it out and I was wondering if you happen to have a version of save.php that writes the content to a text file on the server, and reads it back? It would be very useful for newbies like me. D.
December 6th, 2007 at 12:02 pm
This rocks man! Where is everyone???! This is a good script, needs more visibility! We gotta make an Ad on tv or something =D
December 6th, 2007 at 12:57 pm
@Dennis -
The PHP script is just an example to show how the data is provided. For production use I’d expect people to be storing updates in a database.
@Julien -
Thanks for the kind words, hope people find it useful.
December 7th, 2007 at 1:08 am
Hey Joseph and Dennis (and everyone else obviously), I just coded a simple way to communicate with a db, I know it’s simple matter, but with the simplicity of this script, we may have less experienced people using it.
You can find my example, as well as source files here :
http://www.episode17.com/expo/editinplace_db/databasecall.php
Hope it can help someone!
December 21st, 2007 at 8:29 pm
If anyone is unable to update to Prototype 1.6 the only obvious changes so far relate to the insert class. Change the following lines in editinplace.js as follows:
$(id).insert({after: saving}); becomes -> new Insertion.After(id, saving)
$(id).insert({after: form}); becomes -> new Insertion.After(id, form)
December 30th, 2007 at 10:59 am
Great script, the first that i have actually been able to make work in under 72 hours, lol (actually took me 15 min). I also wrote a file to communicate with a database and write to it, i also wrote an if statement to check what id the field is.
My only issue is that i need to be able to edit multiple instances of one id. I have not been able to make this work. Is there some hack r is there a setting that i can change?
I am attempting to use it in a gallery app that i have created and need to use it for editing of album names and image names.
thanks for a great script, JW
January 6th, 2008 at 10:04 pm
hi, i’ve been using EIP for a while now on Windows and it works fine, however, when I place my code in Linux, it does run, I get this error in Firebug:
syntax error
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.or…
hope you guys can help…
January 7th, 2008 at 11:28 am
@mark -
That doesn’t look like something related to EIP. Is there a public facing page that re-creates this error?
January 13th, 2008 at 7:22 pm
I’ve added an option to your library, as follows:
on line 25, add:
clear_text: false,
This new option will control whether or not the current contents are displayed in form view or if they are wiped clean.
on line 231, add:
if(opt['clear_text']) {
opt['orig_text_encoded'] = ”;
}
Usage:
$(’editme_textarea’).editInPlace({
form_type: ‘textarea’,
clear_text: true
});
Now, when you click on the editable text zone, the form that appears will be emptied. Otherwise, the script defaults to clear_text: false - leaving your old contents in tact for editting.
Hope this makes the next release. All i ask is credit. Thanks.
January 14th, 2008 at 12:45 pm
great script;)
January 14th, 2008 at 4:21 pm
@Rick -
I’m not sure why you’d want to have the current value removed instead of being edited. If you want to provide some default text to show in fields that have no value take a look at the ‘empty_text’ option.
January 20th, 2008 at 2:38 pm
Well, I guess I wasn’t sure I needed that at first either, but here’s my scenario:
A manager needed a simple way of updating/creating “announcements” that are displayed on a primary page of the site. Instead of creating a full-blown content managment, or even editting the existing content manager for just that ONE announcement panel, it was faster and far more intuitive to make it “edit in place” when that manager is logged into the site under their admin-level account. Simple enough, but they want to be able to:
1. edit the existing announcement
2. have the option to create a new announcement, via the same interface.
so… I create two buttons that show only for admin-level accounts:
1. Edit Announcement
2. Create Announcement
Functionally:
1. Click and the existing text remains to be editted within the textarea as needed.
2. Click and the existing text is replaced by a blank textarea form. (Because clicking this option sets the “clear_text” to true)
Using “empty_text” did not apply to the end user experience I was going for, therefore ruled out.
So from there I think you can understand where I’m going with this. I never imagined this as “life or death” addition, simply that it’s just another variable option to provide developers using your EIP.
Furthermore, well done on this. I feel obliged to tell you that I quite prefer your “edit-in-place” to the one available in scriptaculous, as yours is a bit more straight forward while being flexible enough for my needs.
February 4th, 2008 at 11:02 am
@Rick -
Sorry for the delay in getting your comment approved, I got backed up on my email.
That seems like a reasonable use case, I’ll look at adding that to a future version.
February 5th, 2008 at 6:01 pm
I think there are some errors in the code.
This won’t work:
// Encode ”
opt['orig_text_encoded'] = opt['orig_text'].replace(//g, ‘>’);
opt['orig_text_encoded'] = opt['orig_text'].replace(/”/g, ‘"’);
because each encode line goes back to the original text. So if orig_text contains more than one encodable character, only the last substitution will be done.
Also, while the documentation doesn’t quite explain how to use ‘more_data’, this
if(opt['more_data']) {
for(var i in opt['more_data']) {
post_data += ‘&’ + i + ‘=’ + encodeURIComponent(params[i]);
}
}
implies that opt['more_data'] is an array, and I don’t see anything about populating an array. Can you clarify?
April 20th, 2008 at 8:30 am
Hi,
there is a error line 347 :
post_data += ‘&’ + i + ‘=’ + encodeURIComponent(params[i]);
should be replace by :
post_data += ‘&’ + i + ‘=’ + encodeURIComponent(opt['more_data'][i]);
In order to make ‘more_data’ to be passed in the post fields.
example html script code :
$(’desc_en’).editInPlace({
form_type: ‘textarea’,
more_data: {
movie_id: 4,
test: 2
}
});
April 23rd, 2008 at 11:49 am
@savant -
The g option on the end of the replace call tells it to replace all the string everywhere that it is found, not just once. If there is still a problem in there please provide a specific test case so that I can reproduce the problem.
As for making use of more_data, I’ve updated the example page to show how it is used. Also Jerome Neuveglise’s comment has an example.
April 23rd, 2008 at 11:50 am
@Jerome Neuveglise-
You are correct, thank you for pointing this out. I’ve updated the code in the subversion repository and will get a 0.5.1 release out one of these days.