Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/246.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 FCKeditor 1验证不起作用_Javascript_Php_Validation - Fatal编程技术网

Javascript FCKeditor 1验证不起作用

Javascript FCKeditor 1验证不起作用,javascript,php,validation,Javascript,Php,Validation,我正在使用FCKeditor上传数据库中的数据 代码如下 <?php // Automatically calculates the editor base path based on the _samples directory. // This is usefull only for these samples. A real application should use something like this: // $oFCKeditor->BaseP

我正在使用FCKeditor上传数据库中的数据

代码如下

<?php
    // Automatically calculates the editor base path based on the _samples directory.
    // This is usefull only for these samples. A real application should use something like this:
    // $oFCKeditor->BasePath = '/fckeditor/' ;  // '/fckeditor/' is the default value.
    $sBasePath = $_SERVER['PHP_SELF'] ;
    $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
    $oFCKeditor = new FCKeditor('FCKeditor1') ;
    $oFCKeditor->Height = 400;
    $oFCKeditor->BasePath   = $sBasePath ;
    $oFCKeditor->Value= "";
    $oFCKeditor->Create() ;
?>
    <script type="text/javascript">
    function validatearticle() {
    if (document.addtwebinar_frm.FCKeditor1.value == "")
       {
          alert("Please Enter Article Data!");
          document.addtwebinar_frm.FCKeditor1.focus();
          return false;  
       }
    }
    </script>

用于验证的Javascript不允许使用空数据字段,如下所示

<?php
    // Automatically calculates the editor base path based on the _samples directory.
    // This is usefull only for these samples. A real application should use something like this:
    // $oFCKeditor->BasePath = '/fckeditor/' ;  // '/fckeditor/' is the default value.
    $sBasePath = $_SERVER['PHP_SELF'] ;
    $sBasePath = substr( $sBasePath, 0, strpos( $sBasePath, "_samples" ) ) ;
    $oFCKeditor = new FCKeditor('FCKeditor1') ;
    $oFCKeditor->Height = 400;
    $oFCKeditor->BasePath   = $sBasePath ;
    $oFCKeditor->Value= "";
    $oFCKeditor->Create() ;
?>
    <script type="text/javascript">
    function validatearticle() {
    if (document.addtwebinar_frm.FCKeditor1.value == "")
       {
          alert("Please Enter Article Data!");
          document.addtwebinar_frm.FCKeditor1.focus();
          return false;  
       }
    }
    </script>

函数validatearticle(){
if(document.addtwebinar\u frm.FCKeditor1.value==“”)
{
警报(“请输入文章数据!”);
document.addtwebinar_frm.FCKeditor1.focus();
返回false;
}
}
所示的javascript部分是脚本的一部分。其他值和验证,例如相同形式的文章主题、文章作者等正在得到验证。但即使将fckeditor字段保留为空,表单也会被提交

请提供代码或javascript方面的帮助

尝试删除文本中的空白

<script type="text/javascript">
function validatearticle() {
if (document.addtwebinar_frm.FCKeditor1.value.trim() === "")
   {
      alert("Please Enter Article Data!");
      document.addtwebinar_frm.FCKeditor1.focus();
      return false;  
   }
}
</script>

函数validatearticle(){
if(document.addtwebinar\u frm.FCKeditor1.value.trim()=“”)
{
警报(“请输入文章数据!”);
document.addtwebinar_frm.FCKeditor1.focus();
返回false;
}
}

尝试检查长度