Having trouble creating a WYSIWYG field using the Form Builder

edited April 2014 in Bug Reports
I have the following field defined, but the editor never shows up :s

$fields['Profile'] = array(
'type' => 'wysiwyg',
'editor' => 'markitup',
'display_label' => FALSE,
'required' => FALSE
);

$this->form_builder->set_fields($fields);
$vars['business_form'] = $this->form_builder->render_divs();

No javascript errors or other errors on the page...what am I doing wrong?

Comments

  • edited 3:44AM
    You should also add the line:
    $this->form_builder->load_custom_fields(APPPATH.'config/custom_fields.php');
    You may also need to define some other javascript configuration variables that FUEL uses too for paths. You may also need to create a global variable called "jqx_config" that has properties like so:
    jqx_config.assetsImgPath = "<?=img_path('')?>"; jqx_config.editor = 'ckeditor';
    Or you can include the fuel/modules/fuel/views/_blocks/fuel_header_jqx.php file.
  • edited 3:44AM
    Awesome, CKEditor is showing up now, but all of the 'type' => 'text' fields became textareas so I just dropped the 'type' => 'text attribute and all is good.

    I didn't need the jqx_config, but not I need to modify which options are available on the editor. Where would I set this?
  • edited 3:44AM
    There are a few ways to do this depending on where all you want the settings to apply:

    1. The fuel/application/config/MY_fuel.php file has a "ck_editor_settings" configuration parameter you can change

    2. There is a "editor_config" you ca set as a parameter:
    http://docs.getfuelcms.com/general/forms#wysiwyg

    3. You can set a javascript global variable object on your page of "jqx_config.ckeditorConfig" which will get looked at before rendering.
  • edited 3:44AM
    How do I include jqx.js? In my header block or is there a way to added it through a config file?
  • edited 3:44AM
    Actually,

    Can you provide a simple example of a controller that users the form_builder to build a form that includes a WYSIWYG field (ckeditor).

    I'm getting all kinds of javascript errors, but CKEditor shows up but it looks a little funny.

    Very frustrating :(
  • edited 3:44AM
    This is the error that I'm getting now:

    TypeError: 'undefined' is not a function (evaluating 'fuel.getModule()') from custom_fields.js line 76
  • edited 3:44AM
    You may need to include the fuel/modules/fuel/assets/js/fuel/global.js as well.
Sign In or Register to comment.