Permalink
Browse files

Inlineeditor.textarea section added to readme file.

  • Loading branch information...
1 parent 1001886 commit 31be55e4f0db6ef30e443eb578e9808e136ee15a @reednj committed Sep 11, 2011
Showing with 16 additions and 11 deletions.
  1. +16 −11 README.md
View
27 README.md
@@ -10,38 +10,38 @@ How to use
----------
Include the InlineEditor.js and InlineEditor.css (and InlineEditor.Combo.js if you need drop down lists) in the header:
-
+
<link rel="stylesheet" href="InlineEditor.css" type="text/css">
<script type='text/javascript' src='InlineEditor.js'></script>
Make elements editable like this:
-
+
new InlineEditor(element, {url: 'save-change.php'});
When the editbox is saved a GET request will be made to that url with the new data.
Maybe you need to send some meta-data such as a row_id along with the request. Use the 'id' option:
-
+
new InlineEditor(element, {url: 'save-change.php', 'data':{'id':15}});
-
+
You can also place these attributes on the element its self, like this:
-
+
<div class='editable' data-url='save-change.php' data-id='1'>data value</div>
<div class='editable' data-url='save-change.php' data-id='2'>data value</div>
// then you could initialize all these at once like this:
$$('.editable').each(function(item) { new InlineEditor(item); }
-
+
Drop Down Lists
---------------
Use InlineEditor.Combo.js to let the user set input from a drop down list, instead of with a textbox
-These are created in the same way as regular InlineEditors but have more settings to deal with setting the list of
+These are created in the same way as regular InlineEditors but have more settings to deal with setting the list of
options in the dropdown.
This can be done in the javascript constructor:
-
+
new InlineEditor.Combo(element, {
url: 'save-edit.php',
options_list: [
@@ -52,19 +52,24 @@ This can be done in the javascript constructor:
});
or in the dom:
-
+
<div class='editable-combo' data-url='save-edit.php'>
<div data-value='1'>One</div>
<div data-value='2'>Two</div>
<div data-value='3' data-selected='true'>Three</div>
</div>
-
+
+Textarea
+--------
+
+For editing large amounts of text inline, use InlineEditor.Textarea. This works exactly the same as the regular inline editor, except that it creates a Textarea when clicked on, instead of a standard input box.
+
Server Request Format
---------------------
This class will make a request to the given url as a GET, POST or JSON request. The new value will be sent
as 'value', and the extra data will be sent as it is given in the 'data' option.
If there is an error you should return a '500' code. If you send back error information with the type
-'application/json' in the format {code:, message:} the message will be shown as the error on the
+'application/json' in the format {code:, message:} the message will be shown as the error on the
screen, otherwise a generic error message is shown.

0 comments on commit 31be55e

Please sign in to comment.