About SilverIPE

Brief Description

SilverIPE is a cross-browser in place editor JavaScript class. It is easy to use and the script itself is rather tiny (about 4kb compressed). It is well documented and easy to use.

How it Works

SilverIPE will transform any span, div or paragraph into an in place editor. This means that, when an element of your choice is clicked, a text input or a textarea will appear, allowing you to edit the value of the element. Once you are done you can eighter Save or Cancel your changes. If you chose to save your changes, an Ajax request will be made to an URL of your choice, sending a POST parameter (the name of that parameter is up to you) containing the value of the newly edited text.

The Ajax request can be sent to any controller of your choice. It can be a PHP script, a Ruby controller, a Perl script or anything else you can think of. The only thing that your controller is required to do is to print (or echo) the new text value, so that your element (span, div or p...) can be updated with the new text.

FEATURES

  • Lightweight (about 4kb)
  • No dependencies
  • Works with span, divs and paragraphs
  • Cross-Browser (IE5,6 - FireFox - Opera - Safari)
  • Customizable
  • Use with any controller (PHP, Ruby, Perl etc.)

Demos & Examples

SilverIPE works with span items. See if you can edit the following text:
Edit me!

SilverIPE can also be used on block elements such as Paragrahps and Divs.

I'm a paragraph! Try to edit me!

Additionally, SilverIPE will let you know if there is an error going on when sending the XMLHttpRequest. Try to edit the next example, an error will occur (this is normal.):
Try to edit me!

Documentation

Getting it Running

Getting SilverIPE running is extremely easy... Basically you just need to include it in your page. The following code snippet shows how to include SilverIPE in your page:

Don't forget to replace [-version] with the version you chose to download.

Creating a New SilverIPE Object

Once the script is included, all that's left to do is to create a new SilverIPE object. Again, this is very easy. One thing that you should keep in mind is that, you need to create the SilverIPE object after your target element has been inserted in the DOM. There are several ways to do that, use your prefered way. The simplest way is of course to create the object after you've created. Here's an example that shows how to do it.

Don't worry about the parameters and options, they will be explained right... here!

Parameters

Those are the required parmaters when creating a new SilverIPE object. In order it looks like this:

element
The element that will be transformed into an In Place Edit. It can be eighter a string representing the ID of the element, or an object, representing the element itself. The element can be a div, span or a paragraph. Ex: 'mySpan'
url
The url of the controller that will receive the XMLHttpRequest. This should be a string. Ex: 'myController.php'
options
This is an object containing the options you want to apply to your IPE, all of those options are, as the name suggests, optional. A full description can be found just below.

Options

Here's a list of all available options with their description, type and default values.

Option Name Description Type Default
parameterName The name of the POST or GET parameter sent to your controller. String value
method Either 'POST' or 'GET'. String POST
highlightColor The hex color used when mousingover the element and when editing. String #FFFFBF
borderColor The color of the input or textarea's border. String #000
savingText The text displayed while the new value is being saved. String saving...
saveButtonLabel The Save Button text. String save
cancelButtonLabel The Cancel Button text. String cancel
textWidth The input or textarea's width in characters. Number 20
textHeight The textarea's height in characters (i.e. 4 = 4 lines of text). Number 4
additionalParameters Key/Value pairs, additional parameters to pass to your Server Side script. Object {}

Here is an example constructing a new object and using all the options:

About your controller

The controller is basically the script where you chose to send the Ajax request. This controller can do anything but it must do at least one thing: Echo the new text value so that your element can be updated. Here is a sample php script that would do just fine:

Downloads

SilverIPE can be downloaded in 3 different format: Uncompressed, Minified (With JSMin) or Packed (With Dean Edwards packer). The 3 versions behave exactly the same way and the version you chose is totally up to you.

Version Size Download Link
Uncompressed 7kb silveripe.0.2.js
Minified 5kb silveripe-jsmin.0.2.js
Packed 4kb silveripe-packed.0.2.js

Changelog

0.1 to 0.2

  • New "method" option: Allows you to chose to send the request via POST or GET
  • New "additionalParameters" option: Allows you to pass custom parameters to your controler (for example an ID, an action or whatever). Thanks to JasonD for that one, without which the script is pretty much useless! ;)

Comments

03/04/2010
I received my first loan when I was very young and this supported me very much. Nevertheless, I require the term loan again.
02/13/2010
I am to a great extent impressed with the article I have just read. I wish the author of www.silverscripting.com can continue to provide so much useful information and unforgettable experience to www.silverscripting.com readers. There is not much to say except the following universal truth: Paranoids live longer, but they get less done. I will be back.
01/26/2010
The author of www.silverscripting.com has written an excellent article. You have made your point and there is not much to argue about. It is like the following universal truth that you can not argue with: People who eat at hotel restaurants, don’t deserve to visit other countries Thanks for the info.
Jason Said:
11/09/2009
Great work on creating such a lightweight inplace editor. Is there a parameter to tell it to save onblur? If I want the whole form to be posted (along with the new value) is there a way to do this? I have tried doing this with jQuery but couldnt get it working. Any help appreciated! Thanks
Jason Said:
11/09/2009
Great work on creating such a lightweight inplace editor. Is there a parameter to tell it to save onblur? If I want the whole form to be posted (along with the new value) is there a way to do this? I have tried doing this with jQuery but couldnt get it working. Any help appreciated! Thanks
Jason Said:
11/09/2009
Great work on creating such a lightweight inplace editor. Is there a parameter to tell it to save onblur? If I want the whole form to be posted (along with the new value) is there a way to do this? I have tried doing this with jQuery but couldnt get it working. Any help appreciated! Thanks
Jason Said:
11/09/2009
Great work on creating such a lightweight inplace editor. Is there a parameter to tell it to save onblur? If I want the whole form to be posted (along with the new value) is there a way to do this? I have tried doing this with jQuery but couldnt get it working. Any help appreciated! Thanks
Jason Said:
11/09/2009
Great work on creating such a lightweight inplace editor. Is there a parameter to tell it to save onblur? If I want the whole form to be posted (along with the new value) is there a way to do this? I have tried doing this with jQuery but couldnt get it working. Any help appreciated! Thanks
eren Said:
10/20/2009
great Job! i have edited this.request.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=iso-8859-9"); but i still have problems about encoding? can you give me an advice?
04/28/2009
Cool site.
Basab Said:
03/26/2009
Hey friend can you tell me how do i do it in ASP. I am not very conversant with PHP.
EdEdit Said:
02/26/2009
Just need to say that this is absolutely kick ass. Thanks very much for your hard work!
SilverTab Said:
10/07/2008
@JasonD: There you go! The script has been updated, I also added to possibility to chose between GET and POST for the ajax request! Enjoy! :)
SilverTab Said:
10/07/2008
@JasonD: Right now, I don't think it can be done without the script being modified... However, it is a good suggestion so, I'm putting together a new version where it will be possible... (It should be updated later today or tomorrow)
JasonD Said:
10/04/2008
Hi SilverTab Is it possible to send more than one parameter at a time to the controller. for example, if I am editing a database I will need to get the ID of each item so that it can be edited is this possible?
SilverTab Said:
10/03/2008
Let's see if the comment form is fixed...
SilverTab Said:
07/28/2008
Feel free to leave any comment or question here and I'll try to reply ASAP!

Leave a comment

Your Name:
Your Email:


Website:


Comment/Question (No HTML):


An attempt at stopping spam... Can be a bit hard to read sometime so just click on the little arrow button to generate new word untily you get one that's readable.