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
Comment #0.0
bsuttis commentedRewording
Comment #1
bsuttis commentedAfter a lot of googling I found out that IE8 does not like nested forms. After refactoring that, the issues above resolved.
Comment #1.0
bsuttis commentedSCRIPT601: Unknown runtime error too