Javascript API
The ahah_edit_in_place features a comprehensive Javascript API to allow the user to integrate into the edit process. This is achieved by using the jquey event bind / trigger mechanism.
Basic event listening
Let's assume that we have a CCK nodereference field named 'field_eggs' in a node type 'platypus'. For this field, the Edit In Place UI module creates an edit-in-place container with the id 'edit-in-place-platypus-field_eggs'. If we want to add some logic that will be called each time this field is saved, all we have to do is add the following Javascript to our document:
$(document).ready(function(){
$('#edit-in-place-platypus-field_eggs').bind('save', function() {
alert('Eggs have been saved!');
});
});Events
The following events are triggered by the edit in place module, all on the editable container:
load
Triggered when the editable container has finished loading (after the user clicked the 'edit' link)
cancel
Triggered when the user cancels editing on a container
submit
Triggered after a form has been submitted. Accepts two parameters, the event object and the response object transferred by $.post to its callback function.
error
Triggered when the form has errors. Accepts one parameter, an array of form errors.
save
This event is triggered after a field has been saved and the new content has been loaded. Accepts one parameter, the response object transferred from the submit event.
