Disable autosave on editor

Disable autosave on editor

by Conn Warwicker -
Number of replies: 0
Picture of Core developers Picture of Plugin developers

Hi,

We're building up a Moodle form which contains a text editor:

 public function definition() 

    {

        global $CFG;

        $mform = $this->_form;

        

        $mform->addElement('textarea', 'question', 'Title', 'wrap="virtual" rows="1" cols="50"');

        $mform->setType('question', PARAM_TEXT);

                

        $mform->addElement('editor', 'answer', 'Content');

        $mform->setType('answer', PARAM_TEXT);

                

        $mform->addElement('select', 'categories', 'Category', array(1=> 'Moodle', 2=> 'BKSB', 3=> 'Developer'));

        $mform->setType('categories', PARAM_TEXT);

                

        $mform->addElement('select', 'featured', 'Featured', array(0=> 'No', 1=> 'Yes'));

        $mform->setType('featured', PARAM_INT);

                

        $mform->addElement('select', 'visible', 'Visiblility', array(1=>'Visible',0=> 'Hidden'));

        $mform->setType('visible', PARAM_INT);

                

        $mform->addElement('submit', 'questionsubmit', 'Submit'); 

        

    }


But we don't want the text editor to keep a draft of anything we put into it.

I've tried adding a 4th parameter to the editor addElement with: array('autosave' => false), but that doesn't seem to work.


How do we disable the draft autosaving on individual text editors?


Thanks.

Average of ratings: -