我正在使用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() ;
?>和Javascript用于验证的不允许数据字段为空的使用情况如下..
<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部分是脚本的一部分。同样形式的其他值和验证,例如文章主题、文章作者等正在得到验证。但即使在将fckeditor字段保留为空之后,表单仍会被提交。
请在代码或javascript上提供帮助。
发布于 2014-03-18 13:34:15
尝试使用trimming删除文本中的空格。
<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>https://stackoverflow.com/questions/22470577
复制相似问题