I'm loading a node form via an AJAX callback. The node form has a textarea that loads CKEditor. In browsers other than IE8 (and less), there is no issue, but IE8 is a different story.

function resource_flow_edit_subcontent_html($js = NULL, $resource, $content, $subcontent) {
  if ($js) {
    ctools_include('ajax');
    ctools_include('node.pages', 'node', '');

    $form_state = array(
      'ajax' => TRUE,
      'title' => t('Subcontent'),
    );

    $node = node_load($subcontent);
    $form_state['build_info']['args'] = array($node);
    form_load_include($form_state, 'inc', 'node', 'node.pages');

    // Output to empty div.
    $output = render(drupal_build_form($node->type . '_node_form', $form_state));
    $commands[] = ajax_command_html('#subcontent-edit-' . $subcontent, $output);

    print ajax_render($commands);
    exit;
  }
  else {
    ...
  }
}

Attempting to save the form causes a popup that says 'An error occurred while attempting to process /system/ajax: Unknown runtime error'.

Clicking the save button again, the AJAX call works and form submits, however an error SCRIPT5022: Exception thrown and not caught appears in the console.

It states the error is at jquery.js?v=1.4.4, line 34 character 39 but looking at CKEditor's source JS, I believe it is to do with:

if ( !element )
  throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';

Minified in ckeditor.js as if(!d)throw '[CKEDITOR.editor.replace] The element with id or name "'+b+'" was not found.';

I'm still struggling to find out the main cause of the issue, however I have found out that d is an [object HTMLTextAreaElement] when the form loads via AJAX and 'undefined' when clicking 'Save'.

I'm also seeing 'SCRIPT601: Unknown runtime error' when I try to change the Text format of the WYSIWYG-enabled field.

Any guidance is appreciated.

Comments

bsuttis’s picture

Issue summary: View changes

Rewording

bsuttis’s picture

Status: Active » Closed (fixed)

After a lot of googling I found out that IE8 does not like nested forms. After refactoring that, the issues above resolved.

bsuttis’s picture

Issue summary: View changes

SCRIPT601: Unknown runtime error too