Solved

Need 2 text areas using CKEDITOR on same page to have diffrent widths?

Posted on 2013-05-21
3
341 Views
Last Modified: 2013-05-21
Hi,
I have 2 text area on my page using CKEDITOR and need different widths for both, but it appears that both get resized to the same value and in this case using the last value specified of CKEDITOR.config.width ='300px';

Is there a way to specify a diffrent size?

Thanks.
<textarea id="content" name="content"><?php echo $content; ?></textarea>
                     
<script>

CKEDITOR.replace( 'content' );
CKEDITOR.config.width ='800px';
CKEDITOR.config.height='500px';
CKEDITOR.config.skin = 'moonocolor';

</script>                     


<textarea id="content2" name="content2"><?php echo $content2; ?></textarea>
                     
<script>

CKEDITOR.replace( 'content2' );
CKEDITOR.config.width ='300px';
CKEDITOR.config.height='500px';
CKEDITOR.config.skin = 'moonocolor';

</script>                     

Open in new window

0
Comment
Question by:sabecs
3 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 39184219
0
 
LVL 6

Accepted Solution

by:
Robert Saylor earned 500 total points
ID: 39184241
Give this a try. I have a page "php" that uses two CKeditor boxes and both have different sizes.

   <textarea id="editor2" name="editor2" rows="10" cols="80"></textarea>
      <script type="text/javascript">
// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
   document.write(
      '<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
      'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
      'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
      'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
      'value (line 32).' ) ;
}
else
{
   var editor2 = CKEDITOR.replace( 'editor2',
      {

         width: '275px',
         height: '400px',
         toolbar :
            [
               [ 'Source','Preview' ],
               [ 'Bold', 'Italic','Underline','Strike','RemoveFormat', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink', 'Anchor' ],
               [ 'Image','Table','HorizontalRule','SpecialChar','PageBreak'],
               [ 'Styles','Format','Font','FontSize' ],
               [ 'TextColor','BGColor' ],
               [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo','-','Outdent','Indent','Blockquote','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','BidiLtr','BidiRtl' ]
            ]
      });

   editor2.setData( '<?=$sValue2?>' );
   // Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
   // The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
   CKFinder.setupCKEditor( editor2, 'ckfinder/' ) ;
   // It is also possible to pass an object with selected CKFinder properties as a second argument.
   // CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}
      </script>

Open in new window

0
 

Author Closing Comment

by:sabecs
ID: 39184276
Thanks, that did the trick.

CKEDITOR.replace( 'content2',{ width: '275px', height: '400px' });
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now