2012-01-05 26 views
0

jQuery検証プラグインでCKeditorを検証する方法。jQuery検証プラグインでCKEditorを検証する

この私のコードです

<script type="text/javascript"> 
    $(document).ready(function(){ 
     $("#newpost").validate({ 
      debug: false, 
      rules: { 
       title: "required", 
       cat_id: "required", 
       editor1:"required" 
      }, 
      messages: { 
       title: " Title name cannot be blank.", 
       cat_id: " Please select a category.", 
       editor1: " Post keywords cannot be blank."   
      }, 
      submitHandler: function(form) { 
       // do other stuff for a valid form 
       $.post('new_post.php', $("#newpost").serialize(), function(data) { 
       $('#msgw').html(data); 
       });    
      } 
     }); 
    }); 
    </script> 

PHPコード:

<?php 
include ('../db.php'); 

$title = mysql_real_escape_string($_POST['title']); 
$editor1 = $_POST['editor1']; 
$date= date("Y-m-d"); 
$cat_id = mysql_real_escape_string($_POST['cat_id']); 


$qu = mysql_query("INSERT INTO blogposts(title,post,date,catid)VALUES ('".$title."','".$editor1."','".$date."','".$cat_id."')") or die (mysql_error()); 
?> 

問題は、それも、エディタに含まれている投稿dosentです。どうすればこの問題を解決できますか?ありがとうございました。

+0

非常によく似た(または同一の)質問については、関連する列を確認してください。 –

+0

CKEditorは 'TextArea'のインターフェースを変更します。 'TextArea'コンテンツを確認することはできます。コンテンツの受け渡しについては、フォームのsendメソッドともちろん 'TextArea'の名前を設定してください。 – MahanGM

答えて

0

Iは、以下のコード追加しました:

CKEDITOR.instances.pdetails.updateElementを();

pdetailsは、テキストエリアの名前です。あなたのフォームを提出し、テキストエリアを印刷しようとするとき:

$ pdetails = $ _POST ['pdetails'];

print $ pdetails;

テストする前に値が設定されていることを確認してください。

関連する問題