Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript text区域不发送表单不发送表单第一次单击发送。在2处单击“是”_Javascript_Html_Textarea_Tinymce 4 - Fatal编程技术网

Javascript text区域不发送表单不发送表单第一次单击发送。在2处单击“是”

Javascript text区域不发送表单不发送表单第一次单击发送。在2处单击“是”,javascript,html,textarea,tinymce-4,Javascript,Html,Textarea,Tinymce 4,在Tinymce文本区域,它迫使我双击提交表单。在第一次发送中,“var a”为空,在第二次发送中,如果您有数据并且发送正确,请单击。怎么解决呢? <script src="https://cdn.tiny.cloud/1/zgxpx6ymtwpuc7yy5x3wuic7eu7ughi6w7q98msfnxmbcpjp/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <script&

在Tinymce文本区域,它迫使我双击提交表单。在第一次发送中,“var a”为空,在第二次发送中,如果您有数据并且发送正确,请单击。怎么解决呢?

    <script src="https://cdn.tiny.cloud/1/zgxpx6ymtwpuc7yy5x3wuic7eu7ughi6w7q98msfnxmbcpjp/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script>
  <script>
    tinymce.init({
      selector: '#comment',

    });
  </script>
<script type="text/javascript">
  function FQB() {
    var a = document.forms["Formularioqr"]["comment"].value;


    if (a == null || a == "") {
      alert(a);
      return false;
    }else{
        a = a.replace(/\r?\n/g, '<br />');
        $.ajax({
                                            type: "POST",
                                            url: "send-email-manual-envio.php?mesaje=" + a + "&correo=<?php echo $correo;?>" ,
                                            dataType: "json",
                                                success: function() {
                                                        document.getElementById("Formularioqr").reset();
                                                        document.getElementById("showtextqr1").innerHTML =" Enviado Con exito ";
                                                },
                                                error: function() {
                                                        document.getElementById("Formularioqr").reset();
                                                        document.getElementById("showtextqr1").innerHTML = " ERROR!!";
                                                }
                                        });
    }
  }

</script>

  <form  method="POST" autocomplete="off" id="Formularioqr" name="Formularioqr" onsubmit="return FQB()">
    <div class="form-group">
      <label for="comment">Mesaje:</label>
      <textarea class="form-control" rows="12" id="comment" name="comment"></textarea>
    </div>
      <p id="showtextqr1"></p>
      <input type="submit" value="Enviar">
  </form>

tinymce.init({
选择器:“#注释”,
});
函数FQB(){
var a=document.forms[“Formularioqr”][“comment”].value;
如果(a==null | | a==“”){
警报(a);
返回false;
}否则{
a=a.替换(/\r?\n/g,
); $.ajax({ 类型:“POST”, url:“发送电子邮件手册envio.php?mesaje=“+a+”&correo=“, 数据类型:“json”, 成功:函数(){ document.getElementById(“Formularioqr”).reset(); document.getElementById(“showtextqr1”).innerHTML=“Enviado Con exito”; }, 错误:函数(){ document.getElementById(“Formularioqr”).reset(); document.getElementById(“showtextqr1”).innerHTML=“ERROR!!”; } }); } } 梅萨耶:


我还没有试过,但我猜,.value对于tinymce文本区域来说不正常。。tinymce具有获取内容的专用功能。看


我建议,用这种方式来代替这个
var a=document.forms[“formularoqr”][“comment”].value

为什么您有两个
var a
?在Web上复制代码时是我的错误。工作精细var a=tinymce.activeEditor.getContent();并更改此a=a。替换(/\r?\n/g');