I've installed the CK Editor 6.x-1.1 module with CKEditor 3.3.1 and kept most default configuration items.

I created a form module with one textarea field and the CKEditor menu icons do not display at all.

I have done the following:
1. Set permissions.
2. Set to Full HTML.
3. Added the *.edit-dizm-test-field to the "Include" list. (that shouldn't be necessary, should it?)

I do get the standard CKEditor message below the textarea field:
CKEditor: the ID for excluding or including this element is dizm_test/form.edit-dizm-test-field.

Looking at the source code, the only CKEditor file that gets loaded is: /sites/all/modules/ckeditor/ckeditor.css?x"
No CKEditor javascript at all.

The CKEditor module is installed in /sites/all/modules/ckeditor and the appropriate files seem to be there. CKEditor appears in the modules list and I can configure it without issue.

The CKEditor app is installed in /sites/all/modules/ckeditor/ckeditor and the appropriate files seem to be there, including the javascript files.

The global settings for CKEditor show the Path to CKEditor and the Local path to CKEditor set as:
Current path: /sites/all/modules/ckeditor/ckeditor

My test form code is as follows:

function dizm_test_menu() {
  $items['test/form'] = array(
    'page callback' => 'dizm_test_form',
    'access arguments' => array('access content'),
    'description' => t('Test sandbox.'),
    'type' => MENU_CALLBACK,
  );
  return $items;
}

function dizm_test_form(){
  return drupal_get_form('dizm_test_this_form');
}

function dizm_test_this_form($form_state){
 $form['dizm_test_field'] = array('#type' => 'textarea', '#title' => 'Test Field', '#cols'=>100, '#rows'=>10);
 return $form;
}

Any ideas would be greatly appreciated, as I've been banging my head against the wall with this problem for two days. Thanks.

Comments

jaypan’s picture

Look at page.tpl.php in your theme directory. Make sure you have the following code somewhere in the page (it's best right at the very bottom before the closing <body> tag):

print $closure;

No guarantees this is your problem, but it's a start, seeing as it appears that your javascript files aren't being loaded.

Contact me to contract me for D7 -> D10/11 migrations.

alterego55’s picture

Thanks Jay, but no luck. The print $closure is part of my theme. I'm using a sub-theme of the Zen theme. Also, I switched the theme back to Garland and still no javascript. I am getting javascript for other loaded modules such as img_assist and colorbox:

<script type="text/javascript" src="/sites/all/modules/jquery_update/replace/jquery.js?x"></script>
<script type="text/javascript" src="/misc/drupal.js?x"></script>
<script type="text/javascript" src="/sites/all/libraries/colorbox/colorbox/jquery.colorbox-min.js?x"></script>
<script type="text/javascript" src="/sites/all/modules/colorbox/js/colorbox.js?x"></script>
<script type="text/javascript" src="/sites/all/modules/colorbox/styles/default/colorbox_default_style.js?x"></script>
<script type="text/javascript" src="/sites/all/modules/img_assist/img_assist.js?x"></script>
<script type="text/javascript" src="/sites/all/modules/panels/js/panels.js?x"></script>
<script type="text/javascript" src="/misc/collapse.js?x"></script>
<script type="text/javascript" src="/misc/textarea.js?x"></script>

You do seem to be right on target though, javascript for CKEditor is not getting loaded in the $scripts array for some reason. I just don't know the reason. BTW, I went down the path of loading WYSIWYG and tinymce. I had to load tinymce in a non-standard path per instructions: /sites/all/libraries. WYSIWIG configuration sees the tinymce editor and I am able to configure it as the target editor. Guess what? Same problem, no javascript for WYSIWYG or tinymce.

Is there anything else you can think of, that would keep javascript from being loaded?

jaypan’s picture

Did you download the actual ckeditor files from the ckeditor site and install them in the sites/all/modules/ckeditor folder? And are they in the correct subfolder?

Contact me to contract me for D7 -> D10/11 migrations.

alterego55’s picture

The CKEditor module is installed in /sites/all/modules/ckeditor and the appropriate files seem to be there. CKEditor appears in the modules list and I can configure it without issue.

The CKEditor app is installed in /sites/all/modules/ckeditor/ckeditor and the appropriate files seem to be there, including the javascript files.

This is verified in the CKEditor config mgt as follows:

 Path to CKEditor: *
Path to CKEditor (the HTML editor, downloaded from ckeditor.com) relative to the document root.
Available placeholders:
%b - base URL path of the Drupal installation (/).
%m - base URL path where CKEditor module is stored (/sites/all/modules/ckeditor).
Current path: /sites/all/modules/ckeditor/ckeditor
Local path to CKEditor:
The path to the local directory (on the server) which points to the path defined above. Enter either an absolute server path or path relative to "index.php". If empty, CKEditor module will try to find the right path.
Current path: sites/all/modules/ckeditor/ckeditor

I think my problem is at a lower level (who knows why?) as I installed WYSIWYG and tinymce. Their javascript doesn't get referenced either. The thing that really bugs me is the same thing happens with the Garland theme.

goofus’s picture

Hi,
Are you saying that you used the Admin panel, created a test "page" (i.e. any built in content type) and CKEditor works. However, when you build a form with FAPI it doesn't?

I know how to turn off the wysiwig editors with FAPI. However, I can't figure out if you simply have a post installation issue or you are actually developing anything.

tetherow’s picture

Did you get this working? I am having the same problem. CKeditor works for node types just fine, but on a form api form I do not see it for the textarea fields, I do see the if you want to include/exclude this elemenet is ..... and I do have an Input format fields set for the form element (and the default is Full HTML).

goofus’s picture

Hi,
Try adding a filter element to your form definition:

'format' => filter_form($value = FILTER_FORMAT_DEFAULT, NULL, array('format'))

chintu_ddu’s picture

I have tried to add the format but its still not coming.

Its coming on node/add/page and not coming on the node in which I have used form api.
Is there any solution? I have been heading from last 3 days still didn't find the exact solution.

Any help would be appreciated.

chintu_ddu’s picture

Just add the id property to your form element.

e.g
$form['sample'] = array('#type'=>'textarea', '#id' => description)

its works for me.

tomas.teicher’s picture

the solution with id works for me to. Thank you for the tip. How did you come to this? #id as I know is not part of Fomr API.

Levure’s picture

Hello !

On Drupal 7 (D7), replacing

'#type' => 'textarea', 

by

'#type' => 'text_format', 

makes CKEditor working ! :-)

alterego55’s picture

Unfortunately, I had to regroup and go with Dot Net Nuke instead. But, I'm working another Drupal project currently and I hope this will work if I need to create my own forms again.