使用SCEditor(所见即所得BBCode)时无法验证空字段

Can not validate empty fields when using SCEditor (WYSIWYG BBCode)

本文关键字:验证 字段 SCEditor 所见即所得 BBCode 使用      更新时间:2024-05-06

几天前,我从安装了SCEditorhttp://www.sceditor.com/在我的网站上。今天我发现检查文本区域是否为空会导致问题。当我提交表格时,我总是收到"表格为空"的警告,即使它不是空的。当我再次点击"提交"按钮时,警报不会再次出现。

有人能帮我吗?我想把这个问题发布在sceditor网站上,但看起来没有人再监控它了。

谢谢。

==========================

<script type="text/javascript">
function checkform(form) {
if (form.section.value == "")
{alert("Form is empty");return false;}
</script>

<script src="/scripts/sce.js" type="text/javascript"></script>
<script>
$(function() {
$("textarea").sceditor({
plugins: 'bbcode',
toolbar: "bold,italic,underline,quote,bulletlist,emoticon,color,youtube|removeformat",
enablePasteFiltering:true,
style: "/css/sce.css"
});});
var bbcodes = ['s', 'sub', 'sup', 'font', 'size', 'list', 'ol', '*','table', 'tr', 'th',  'td', 'emoticon', 'horizontalrule',  'img', 'url', 'email','code', 'left', 'center', 'right', 'justify', 'rtl', 'ltr', 'hr'];
$.each(bbcodes, function(idx, bbcode) { $.sceditorBBCodePlugin.bbcode.remove(bbcode);});
</script>
<form action="save.php" method="post" name="forum" onSubmit="return(checkform(this));">
<textarea name="text"></textarea>
<input class="butt" type="submit" value="Save" />
</form>
if($(".sceditor-container iframe").contents().find("body").text() == ""){
alert("error");
}

尝试使用此代码验证bbcode,这对我来说是有效的

好吧,你的工作是做还是不做。

 jQuery('.table_container a.replay_comment').click ->
    a=jQuery(this)
    bbcode='[quote] repondre '+a.attr('data-user-name')+' : 'n'n'  +a.attr('data-bbcode')+' [/quote] [hr]'
    jQuery('#comment_content').sceditor('instance').val(bbcode)