Documentation

Autosave

url

Type: String

Default: false

This setting allows you to specify the path to the server-side script, which will receive and save the content. The request will be sent as a POST.

RedactorX('#entry', {
    autosave: {
        url: '/savedata-server-script/'
    }
});

name

Type: String

Default: false

By default, Autosave uses the name of the element’s textarea attribute as the variable name for the content. This can be changed by specifying another name for Autosave:

RedactorX('#entry', {
    autosave: {
        url: '/savedata-server-script/',
        name: 'myname'
    }
});

Now the server-side will receive a POST request with the key myname for content.

data

Type: Object

Default: false

This setting allows you to send additional options with a POST autosave request.

RedactorX('#entry', {
    autosave: {
        url: '/savedata-server-script/',
        data: {
            id: 10,
            elements: '#my-input-1, #my-input-2, #my-form'
        }
    }
});

The example above shows how to send POST params with autosaving. The data object has key=value params, including values in the input and form fields if the additional object has key elements with field and form selectors.

The values of the input and form fields are appended as values: field-name: value.

method

Type: String

Default: post

With this setting, you can change the method of sending a request.

RedactorX('#entry', {
    autosave: {
        url: '/savedata-server-script/',
        method: 'put'
    }
});