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

A few days ago I installed SCEditor from http://www.sceditor.com/ on my website. Today I discovered that it causes problem to check if textarea is empty or not. When I submit form I always get alert "Form is empty" even if it's not empty. When I click on "Submit" button one more time, the alert doesn't show up again.

Can somebody help me? I wanted to post this question on sceditor website but it looks that noone is monitoring it anymore.

Thanks.

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

<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>

Answers


if($(".sceditor-container iframe").contents().find("body").text() == ""){
alert("error");
}

Try this code to validate the bbcode,this is working for me


Ok your job is to be or not to be.

 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)

Need Your Help

Detect a specific html entity character and replace it with another one

javascript html character ascii detect

Using Javascript, I want to test for the presence of a right arrow character ⇒ in a string and replace it by a down arrow character ⇓

Trouble displaying 3D objects with UV mapping from 3DS Max with OpenGL ES

iphone android opengl-es 3d collada

I've managed to display OBJ and Collada files in Android using OpenGL ES but when UV mapped textures are added to the equation I experience some issues. The texture displays incorrectly and the ob...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.