I'm struggling to post data from "editor" form field. When I do it without ajax it shows the value while, with AJAX it just make it blank.

Array ( [subject] => asdasdasdasd [description] => [priority] => 3 [cc] => [bcc] => [id] => [created_by] => 688 )

Notice the [description] field. I filled the data with test but still it is empty.

It looks like my jquery is serializing the data and not able to find a value from editor field. When I try to print $data it outputs like following:

Please see my code for more information:


jQuery(document).ready(function ($) {
    $('#request-form #submit').click(function (e) {
            url: 'index.php?option=com_helpdesk&task=request.save',
            type: 'POST',
            beforeSerialize: function($form, options) {
                // I was just trying to see what it prints. It is just showing the serialize form values
            success: function (result) {
                var response = $.parseJSON(result);
                if (!response['success']) {
                else {
                        title: "Success",
                        message: response['message']


public function save($key = null, $urlVar = null)
        // Check for request forgeries.
        JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

        $model    = $this->getModel();
        $app      = JFactory::getApplication();
        $table    = $model->getTable();
        $key      = $table->getKeyName();
        $data     = $this->input->post->get('jform', array(), 'array');
        $recordId = $data[$key];

        if (!$this->allowSave($data, $key))
            echo new JResponseJson(NULL, JText::_('COM_HELPDESK_ERROR_ACTION_NOT_PERMITTED'), TRUE);

        $form = $model->getForm($data, false);

        if (!$form)
            echo new JResponseJson(NULL, JText::_('COM_HELPDESK_GENERAL_ERROR'), true);

        // Validate and Filter data by passing it to Model
        $data = $model->validate($form, $data);

        if (!$data)
            echo new JResponseJson(NULL, JText::_('COM_HELPDESK_INVALID_DATA_ERROR'), true);

        if (!$model->save($data))
            echo new JResponseJson($response, JText::_('COM_HELPDESK_SAVE_ERROR'), true);

        $isNew = $model->getState('request.new');

        if ($isNew)
            $recordId = (int) $model->getState('request.id');
            $message  = JText::sprintf('COM_HELPDESK_REQUEST_NEW_SAVE_SUCCESS', $recordId);
            $message = JText::sprintf('COM_HELPDESK_REQUEST_EDIT_SAVE_SUCCESS', $recordId);

        $redirect = JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToItemAppend(), false);
        echo new JResponseJson($redirect, $message);

Form XML:



When I click on Save button my textarea gets filled with editor but for that, I was forced to use Non-Ajax method. I want it to be done with AJAX way.

1 Answer 1


I managed to do it with following. I know, this is not the best way to implement it. I will wait for expert reviews from JSE.

I used beforeSerialize property of ajaxSubmit JS and added following code:

beforeSerialize: function() {


JCE Editor dispatch it's content to parent textarea only when the Save or Toggle Editor button is clicked. As I'm Ajaxifying my component, my page doesn't get refreshed hence "Save" prevents it's default behaviour.

Therefore, I enabled "Toggle Editor" button from JCE component and added:


This code twice.

For the first time it will toggle editor with Normal textarea and in the second statement it toggles back to original editor. It is needed because JCE save toggle editor state (may be through cookies)

Any better solution would be appreciable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.