Very Simple Inline Editing


I wanted inline editing for Mammon (and eventually Eldmyra), but after looking around on the net I was disappointed at the libs available. The only one I found that looked somewhat reasonable had all the code in portugese or something. Note to aspiring developers: always write code in English. Anyway, after some fiddling I present to you Very Simple Inline Editing:

  1. Include the following script file: (requires the Prototype JS library)
  2. Mark up the parts you want to edit. So if you before had {{my_variable}} change it to:
    <span class="inline_editable" edit_url="/path_to_server_side_command/" id="{{my_variable}}_id">

    Note that you need a unique id on the tag.
  3. Implement the server side handler. The new data comes as a parameter ”new_content” in the POST request. Whatever is returned from the server side is inserted into the element when it’s done.

And that’s it!

– Möller



Fyll i dina uppgifter nedan eller klicka på en ikon för att logga in: Logo

Du kommenterar med ditt Logga ut / Ändra )


Du kommenterar med ditt Twitter-konto. Logga ut / Ändra )


Du kommenterar med ditt Facebook-konto. Logga ut / Ändra )

Google+ photo

Du kommenterar med ditt Google+-konto. Logga ut / Ändra )

Ansluter till %s

%d bloggare gillar detta: