php - 验证FCKEditor是否为空

标签 php javascript fckeditor

我正在尝试使用 JavaScript 验证 fckeditor 值是否为空,但没有成功。

我正在使用 javascript 创建编辑器:

var oFCKeditor = new FCKeditor('txtMessage');
                                                 oFCKeditor.BasePath = "../fckeditor/";
                                                 oFCKeditor.ToolbarSet = "Default";
                                                oFCKeditor.Height = "500";
                                                  oFCKeditor.Value = "test";
                                                oFCKeditor.Create();

但是当我使用时:

 if (document.form.txtMessage.value == "") {
      alert('You Must Enter a Message');

当编辑器为空并提醒我并且我在其中写入内容时,它会一直提醒它为空。

最佳答案

检查这里

    <script type="text/javascript">
        function checksubmit() {        
            var FCKGetInstance = FCKeditorAPI.GetInstance('PageDescription');  
            var getText = FCKGetInstance.GetData(); 
            var StripTag = getText.replace(/(<([^>]+)>)/ig,"");
            if(StripTag=='') {
                alert("This is required field");
                return false;
            }
            else {
                alert(StripTag);
            }       
        }
     </script>

<input type="submit" name="submit" value="submit" onclick="javascript: return checksubmit();" />

关于php - 验证FCKEditor是否为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10596884/

相关文章:

PHP 警告 : array_shift() expects parameter 1 to be array, null 在/home5/.../php/symfony/command/sfCommandManager.class.php 中给出

php - array_map 并将字符串附加到数组的元素

javascript - 如何为用户制定自定义路线?以及如何为其添加钩子(Hook)?

javascript - 在 Jade 和 Javascript 之间共享布局信息

c# - 在表单应用程序中使用像 FckEditor 这样的编辑器

php - 用于 nodejs 应用程序的 Paypal 快速结帐

php - 使用 CSS 时 Dropmenu 不起作用

javascript - 外部 iframe 更改大小

fckeditor - FCKeditor 的免费拼写检查器?

php - 插入表单时如何删除 Word 标记废话?