2011-12-21 26 views
2

在使用textarea和ckeditor支持的表單中。如何使用CkEditors驗證多個文本區

用戶可以靈活地添加儘可能多的textareas,並且ckeditors也可以同時加載。

現在我發現的困難是驗證提供的ckeditor的靜態textarea以及用戶動態加載的1。

PLZ給我建議的解決方案......

回答

0

您可以使用您的枚舉網頁上的所有CKEDITOR實例:

for(var x in CKEDITOR.instances) { 
    var inst = CKEDITOR.instances[x]; 
    // now you can validate the value in inst 
} 
0

羅列網頁上的所有instences。使用jQuery來驗證所有。

$("#my-form-submit-button").click(function(e){ 
    e.preventDefault(); 
    CKEDITOR.instances.event-body.updateElement(); 
    $('#event').validate({ 
      // Validation code will go here 
    }); 
}) 

它會更新你的ckeditor,並將ckeditor的值分配給你整合它的textarea。