0

I am using Ckeditor in codeigniter.I need multiple ckeditor instances on same form page but it is not working.Below is my code

    <div class="form-group">
      <?php echo form_label('Short Description','',array('class'=> "col-sm-2 control-label")); ?>
      <div class="col-sm-8">
          <?php echo $this->ckeditor->editor("short_desc",set_value('short_desc'));?>
      </div>
    </div>

    <div class="form-group">
      <?php echo form_label('Description','',array('class'=> "col-sm-2 control-label")); ?>
      <div class="col-sm-8">
        <?php echo $this->ckeditor->editor("description",set_value('description'));?>              
      </div>
    </div>

while it is loading ckeditor for first textarea,it it not working for second one.

vishal shah
  • 316
  • 2
  • 12

2 Answers2

0

In Html document textarea and the solution is this:

<textarea id="short_desc" name="short_desc"></textarea>

<script>
    CKEDITOR.replace('short_desc');
</script>

Or you can follow these step provided by Christian Giupponi. Here is the Link.

Community
  • 1
  • 1
Noman
  • 1,459
  • 2
  • 18
  • 38
0

After debugging and searching for the answer, I have changed the name of second field from description to long_description and that worked for me.

Ckeditor needs unique id.

<div class="form-group">
      <?php echo form_label('Short Description','',array('class'=> "col-sm-2 control-label")); ?>
      <div class="col-sm-8">
          <?php echo $this->ckeditor->editor("short_desc",set_value('short_desc'));?>
      </div>
    </div>

    <div class="form-group">
      <?php echo form_label('Description','',array('class'=> "col-sm-2 control-label")); ?>
      <div class="col-sm-8">
        <?php echo $this->ckeditor->editor("long_description",set_value('description'));?>              
      </div>
    </div>

Thanks

vishal shah
  • 316
  • 2
  • 12