Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6476773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:52:00+00:00 2026-05-25T06:52:00+00:00

How would I go about getting ckeditor’s preview button to send the content to

  • 0

How would I go about getting ckeditor’s preview button to send the content to the server so I can show it in a custom page when preview is clicked?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:52:00+00:00Added an answer on May 25, 2026 at 6:52 am

    We’re doing something like this except that we have a preview link on the page that loads the editor. The approach could be used for a button within the editor, but it requires additional coding (I’ll outline that approach at the bottom).

    The preview link looks something like this:

    <a href="#" onclick="return doPreview();">Preview the page</a>
    

    We have the doPreview function:

    function doPreview() {
    var hiddenForm = document.forms[ 'hidden_form' ];
    
    // TextareaId is the id of the textarea being replaced with CKEditor (the instance name)
    hiddenForm.elements[ 'preview_content' ].value = CKEDITOR.instances.TextareaId.getData();
    
    // "myform" is the active form that contains the textarea replaced by CKEditor.
    var liveForm = document.forms[ 'myform' ];
    if ( ! liveForm ) {
      alert( 'Error finding "myform" form.' );
      return false;
    }
    
    hiddenForm.submit();
    
    return true;
    

    }

    Finally, there’s a form with hidden fields (hiddenForm):

    <form name="hiddenForm" action="HTTP://www.yoursite.com/preview_template" method="POST" target="_blank">
      <input type="hidden" name="preview_content" value="" />
    </form>
    

    So, the link is clicked and the doPreview function is called.
    The function grabs the content from CKEditor and assigns it to a hidden field in the hidden form.
    Then the function submits the hidden form.
    The hidden form is posted and the preview template is loaded in a new window.
    The content area of the preview template is populated with $_POST[‘preview_content’] (the content data from the editor).

    You can modify to contain any variables you need to post.


    To do this by clicking a button within CKEditor:
    You could create a custom plugin. There’s a tutorial section with easy instructions for creating a plugin here:
    http://docs.cksource.com/CKEditor_3.x/Tutorials

    The plugin could work with a hidden form on the main page again, you’ll need to call the parent window from your plugin function.

    Or, you could compose the form with JavaScript within your plugin and submit it from there.

    Note: You can disable the default preview functionality using this setting:

    config.removePlugins = 'preview';
    

    Be Well,
    Joe

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How exactly would one go about getting an OpenGL app to run fullscreen straight
http://t-webdesign.co.uk/new/ How would i go about getting the grey div (#content_right) to expand to
How would I go about getting a div based on its' position in HTML.
How would you go about getting a completely unparsed response to a HTTPS request?
How would I go about getting an array of all the files in a
How would I go about getting the Windows user credentials from a Swing application?
How would I go about getting a string from a UITextField in the iPhone
Given the XML below how would I go about getting a list of employees
So i got the database.objects.all() and database.objects.get('name') but how would i got about getting
How would one go about getting the z order (layer depth of ) all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.