Search code examples
phpjquerytinymcefacebox

tinymce text area in facebox modal window not allowing me to type


i am using facebox (a jquery modal plug-in) and tinymce for my textboxes. however when i open any modal windows, i cannot type anything within the tinymce input box.

any help?

    <script type="text/javascript" src="resources/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>

        <script type="text/javascript">
        tinyMCE.init({
         mode : "textareas",
         theme : "simple"
        });
        </script>

    <link href="resources/facebox.css" media="screen" rel="stylesheet" type="text/css"/>

    <script src="resources/facebox.js" type="text/javascript"></script>

    <script>
    jQuery(document).ready(function($) {
      $('a[rel*=facebox]').facebox()
    })
    </script>

<?php

    echo "<div style='display: none;' id='c".$oh_id."' rel='facebox'><div style='overflow: -moz-scrollbars-vertical; overflow-y: auto; width: 100%; height: 375px;'><h2 style='color: #3399cc;'>Comments for ".$row_clientName['clientName']."</h2>"; 

    echo '<form method="post" action="somepage">
     <textarea name="content" id="content" style="width: 300px; height: 125px;">
     Comments...
    </textarea><br />
    <input type="submit" value="Update" name="submit" class="comment_button"/><p>
    </form></div>';

?>

Solution

  • Call this when your modal window loads:

    var mce_editor = $('<textarea cols="10" rows="110" />');
    mce_editor.tinymce({ script_url: '/{your path}/tinymce/tiny_mce.js', theme: "advanced", template_replace_values: { username: "Sample User", staffid: "991234"} });
    

    Hope this helps.