Foros del Web » Programando para Internet » Javascript »

Problema con ajax y tinYmce

Estas en el tema de Problema con ajax y tinYmce en el foro de Javascript en Foros del Web. Hola a todos, estoy utilizando en plugin de editor de textos tinYmce, el problema mio surge cuando cargo mediante un botón con funcionalidad ajax jquery ...
  #1 (permalink)  
Antiguo 27/03/2012, 07:08
 
Fecha de Ingreso: mayo-2010
Mensajes: 70
Antigüedad: 14 años
Puntos: 1
Problema con ajax y tinYmce

Hola a todos, estoy utilizando en plugin de editor de textos tinYmce, el problema mio surge cuando cargo mediante un botón con funcionalidad ajax jquery una nueva div con un formulario de ingreso de texto que contiene el editor tinymce.
Cuando hago click por primera vez me carga el editor correctamente, pero si lo vuelvo a hacer este editor desaparece y veo solo el text area, aquí parte de mi código...

ESTE ES EL FORMULARIO DE INGRESO QUE CARGO POR AJAX JQUERY DESDE UN BOTÓN

Código PHP:

function formEvento()
{    
    echo 
'<script type="text/javascript">
    
    
            
                $("#form_publicar").bind(\'form-pre-serialize\', function(e) {
                    tinyMCE.triggerSave();
                });            
    
                 $("#f_desde").datepicker({
                   showOn: "both",
                   buttonImage: "icons/Icon_calendar.png",
                   buttonImageOnly: true,
                   changeYear: true,
                   numberOfMonths: 1,
                    
                   onSelect: function(textoFecha, objDatepicker){
                      $("#mensaje").html("<p>Has seleccionado: " + textoFecha + "</p>");
                   }
               });
               
               $("#f_hasta").datepicker({
                   showOn: "both",
                   buttonImage: "icons/Icon_calendar.png",
                   buttonImageOnly: true,
                   changeYear: true,
                   numberOfMonths: 1,
                   onSelect: function(textoFecha, objDatepicker){
                     // $("#mensaje").html("<p>Has seleccionado: " + textoFecha + "</p>");
                   }
               });

                var options =
                {  
                        success: function(msj)
                        {    
                         $("#retorno").html(msj);
                     },
                    
                 };
                 
                    $("#form_publicar").ajaxForm(options);
                    
                    tinyMCE.init({
                        
                        // General options
                    mode : "none",
                    theme : "advanced",
                    language : "es",
                    width: "100%",
                    height: "180",
                    plugins : "ibrowser,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
                
                     // Theme options
                       theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",    
                       theme_advanced_buttons2 : "bullist,numlist,|,undo,redo",
                    theme_advanced_buttons3 : "",
                    theme_advanced_toolbar_location : "top",
                    theme_advanced_toolbar_align : "left",
                    theme_advanced_statusbar_location : "bottom",
                    invalid_elements : "' 
$gestion_opts['invalid_elements_editor'] . '",   
                    theme_advanced_resizing : false,
                    document_base_url : "' 
$url_sitio '"
                });
            
    </script>'
;
    
    echo 
'<div id="retorno"></div>';
    
    if ( 
$errors !== true )
    {
    
    echo 
'<h3>Ingrese su publicación</h3>
    
     <form action="./?ajax=mkt-eventos-json&act=enviar_evento"  method="post" id="form_publicar">
         <table style="width: 100%;">
         <thead></thead>
         <tfoot></tfoot>
         <tbody>
             <tr>
                  <td style="width:20px;">Título</td>
                  <td><input type="text" name="titulo" value="' 
$titulo '"></td>
                              
              </tr>
              <tr>
                  <td style="width:120px;">Publicar:</td>
                  <td>Desde:<input type="text" readonly name="f_desde" id="f_desde" style="width: 70px;">Hasta:<input type="text" name="f_hasta" readonly id="f_hasta" style="width: 70px;"></td>
              </tr>
              <tr>
                  <td style="width:120px;">Horario:</td>
                  <td>Desde: <input type="text" style="width: 30px;" name="hora_d" value="00">:<input type="text" style="width: 30px;" name="minutos_d" value="00"> 
                  Hasta: <input type="text" style="width: 30px;" name="hora_h" value="23">:<input type="text" style="width: 30px;" name="minutos_h" value="59"></td>
              </tr>
              <tr>
                  <td style="width:120px;">Lugar:</td>
                  <td><input type="text" id="lugar" name="lugar" value="' 
$lugar '"</td>
              </tr>
              <tr>
                  <td style="width:120px;">Descripción corta:</td>
                  <td><input type="text" name="descr_corta" style="width: 100%;">' 
$descr_corta '</textarea></td>
              </tr>
              <tr>
                  <td style="width:120px;">Descripción larga:</td>
                  <td><textarea style="height: 125px; width: 100%;" name="descr_larga" class="descr_larga_a" id="descr_larga">' 
$descr_larga '</textarea></td>
              </tr>
              <tr>
                  <td colspan="2" style="text-align: right;"><input type="submit" style="width: 60px;" value="Publicar" class="publicar" name="publicar"></td>
              </tr>
              <tr>
                  <td><input type="hidden" name="tipo_id" value="' 
$_POST['tipo_id'] . '"></td>
                  <td><input type="hidden" name="uid" value="' 
consultar_config('fingerprint') . '"></td>
                  <td><input type="hidden" name="tic_id" value="' 
$_POST['tic_id'] . '"></td>
              </tr>        
          </tbody>
          </table>
     </form>
    
    
    <script type="text/javascript">
        
        tinyMCE.execCommand("mceAddControl", false, "descr_larga");
         
    </script>
    '
;
    }


Etiquetas: ajax
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:19.