tinymce textarea does not work

0

I have a textarea in a form that I use with a tinymce control ... I just applied what I already did in another form and it worked perfectly.

<script type="text/javascript" src="../../js/tinymce/tinymce.min.js"></script>
    <script type="text/javascript">
        tinymce.init({
            selector: "#objetivo",
            language_url : '../../js/tinymce/es.js',
            remove_linebreaks : false,
            plugins: [
                'advlist autolink lists charmap print',
                'searchreplace code',
                'table contextmenu paste code pagebreak'
            ],
            toolbar: 'undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | pagebreak',
        });
    </script>

I DEFINE the tinymce (it shows me perfect in the form) the form I have defined it in this way, it is much more extensive with many controls, but go step by step, everything works before textarea ... it is say I can record the data, but for some reason when I place the textarea I press the submit button and nothing happens ... not a single error message ... that is, it DOES NOT HAPPEN ... the form is like this:

<form action="guardar.php" method="POST">
    <label>Título del Curso de Formación:</label>
    <input id="nombre_curso" type="text" name="nombre_curso" required>

    <label>Nombre/Empresa que lo realiza:</label>
    <input id="dicta" type="text" name="dicta" required>

    <label>Lugar donde se cursa:</label>
    <input id="lugar" type="text" name="lugar" required>

    <label>Objetivos Generales:</label>
    <textarea id="objetivo" name="objetivo" required ></textarea>



    <div class="g-recaptcha" data-sitekey="xxxxxxxxxxxxxxxxxxxxxxx"></div>
    <br>

    <input type="submit" name="save" value="Submit" />
    <a href="formacion.php"><i class="book icon"></i>Cursos y Capacitaciones</a>
</form>

later in the save.php I have nothing strange ... the problem is that it does not come to save.php ... and I do not know how to get out of this crossroads. I tried to extract the id to the textarea so that it does not take the tinymce and it turns out that it works perfect ... it is as if it identifies that the problem is evidently in the textarea when I put the tinymce ...

 //Si supera el captcha es porque es un humano
    $nombre = $mysqli->real_escape_string($_POST['nombre_curso']);
    $dicta = $mysqli->real_escape_string($_POST['dicta']);
    $lugar = $mysqli->real_escape_string($_POST['lugar']);

    $allowedTags='<p><strong><em><u><h1><h2><h3><h4><h5><h6><img><li><ol><ul><span><div><br><ins><del><small>';
    if($_POST['objetivo']!='') {
        $sObjetivo = strip_tags(stripslashes($mysqli->real_escape_string($_POST['objetivo'])),$allowedTags);
        echo $sObjetivo;
    } else {
        $sObjetivo = "";
    }

    $sql = "INSERT INTO cursos (nom_cur, dictanc, dom_cur, objetiv) VALUES('$nombre', '$dicta', '$lugar', '$sObjetivo')";
    $resultado = $mysqli->query($sql);

    if($resultado) {
        echo "todo perfecto";
    } else{
        echo "error al guardar";
    }

how it makes me angry that there is no way to detect the error quickly !!!

    
asked by MNibor 14.07.2017 в 16:43
source

1 answer

0

I removed the REQUIRED to the textarea that has the tinymce and it worked.

<textarea id="objetivo" name="objetivo"></textarea>
    
answered by 14.07.2017 / 16:47
source