views:

52

answers:

1

I have form with Tinymce. I am saving text writen in tinyMce using ajax call. when I press the save button it does not save the latest value which i entered in tinymce. i.e. when i load the page, default value in the field is "aaaa". I update it to "bbb" and press the save button. but it saved the value "aaaa". Now I change the value from "bbb" to "ccc" and press the save button now it save the previous value "bbb" not "ccc". so it is keep saving the one step old value. I don't know why?

Here is the saveAction which I am calling on Save button using ajax

public function saveAction() {

$this->_helper->layout->disableLayout();        
$this->_helper->viewRenderer->setNoRender(true);    

var_dump ($_REQUEST);       
    if($this->getRequest()->isPost())
    {
        $data=$this->_getParam('content');

           var_dump($_REQUEST); // var dump shows the old value each time i press the save button
     }

here is my form

here is ajax script

$('#frm').submit(function() { 
    var options = { 
        target:        '#response',   
        beforeSubmit:  showRequest,  
        success:       showResponse,  
    url: '/admin/index/save'
        };

  $(this).ajaxSubmit(options); 

  return false; 
    }); 

function showRequest(formData, jqForm, options) { 
var queryString = $.param(formData); 
}

function showResponse(responseText, statusText, xhr, $form)  { 
}
A: 

Try to do the following on button click before you anything else:

tinymce.activeEditor.save();

This will set the actual editor content to the textarea in the background.

Thariama