English 中文(简体)
编辑
原标题:validating multiple TinyMCE Editor

我的表格有多个锡里娅·马塞卡编辑。 一些编辑是预发的,有些是简单的编辑。 我使用了jquery accreditation plugin在客户方进行验证。 我通过添加以下代码对单一锡里文化研究中心编辑进行了认证。

$( #submit ).click(function() {

    var content = tinyMCE.activeEditor.getContent(); // get the content

    $( #description ).val(content); // put it in the textarea

});

但是,现在应该验证所有编辑,什么想法?

最佳回答

Try

$( #submit ).click(function() {

  for (i=0; i < tinymce.editors.length; i++){
    var content = tinymce.editors[i].getContent(); // get the content

    $( #description ).val(content); // put it in the textarea
  }
});

或者

$( #submit ).click(function() {
     tinymce.triggerSave();
});
问题回答

一种比较通用的办法是将编辑的内容重新排在文本里,然后让编辑的鉴定在文本里起到mag的作用。

tinymce.init({
    setup: function (editor) {
        editor.on( init change , function () {
            editor.save();
        });
    }
});

由于锡石字塔是隐蔽的,你还必须将 j鱼鉴定法修订为类似内容。

$( #myform ).validate({
    ignore:  :hidden:not(textarea) 
});

喜欢

java 字母代码

 jQuery(document).ready(function(){
            // binds form submission and fields to the validation engine
            jQuery("#formID").validationEngine();
        });

Html Code

First TinyMCE

 <textarea rows="" cols="" id="first" class="validate[required] text-input tinymce"></textarea>

第二批TinyMCE

<textarea rows="" cols="" id="second" class="validate[required] text-input tinymce"></textarea>

i 也是这样,它给我工作罚款。

f you have Html editor tinymce the required validation is not working ok, you can use this code to solve your problem, install tinymce in your application if you have more than one Htmleditor you can do this i know this is proper solution but you can do it and solve this problem

模型给出了锡石的道路。 cshtml page ok

  [Required(ErrorMessage = "Please enter About Company")]
  [Display(Name = "About Company : ")]
  [UIHint("tinymce_jquery_full"), AllowHtml]
  public string txtAboutCompany { get; set; }

  [Required(ErrorMessage = "Please enter About Company")]
  [Display(Name = "About Company : ")]
  [UIHint("tinymce_jquery_full"), AllowHtml]
  public string txtAboutCompany { get; set; }

现在,您认为,这段话有点。

 <div class="divclass">
     @Html.LabelFor(model => model.txtAboutCompany, new { @class = "required" })
     @Html.EditorFor(model => model.txtAboutCompany)
     <span class="field-validation-error" id="AC" style="margin:9px 0 0 157px;"></span>
 </div>
<div class="divclass">
     @Html.LabelFor(model => model.txtAboutCompany, new { @class = "required" })
     @Html.EditorFor(model => model.txtAboutCompany)
     <span class="field-validation-error" id="AC" style="margin:9px 0 0 157px;"></span>
 </div>

在提交纽特州点击活动中创建 j

$("#BusinessProfile").click(function () {
    var aboutC = $("#txtAboutCompany").val()
    var pinfo = $("#txtProductinfo").val();
    if (aboutC == "" && pinfo == "") {
        $("#AC").append("").val("").html("Please enter about company")
        $("#PI").append("").val("").html("Please enter product information")
        $("#bpform").valid();
        return false;
    } else if (aboutC == "") {
        $("#PI").append("").val("").html("")
        $("#AC").append("").val("").html("Please enter about company")
        $("#txtAboutCompany").focus();
        $("#bpform").valid();
        return false;
    } else if (pinfo == "") {
        $("#AC").append("").val("").html("")
        $("#PI").append("").val("").html("Please enter product information")
        $("#txtProductinfo").focus();
        $("#bpform").valid();
        return false;
    }
    else {
        $("#AC").append("").val("").html("");
        $("#PI").append("").val("").html("");
        //return true;
        $("#bpform").validate();
    }
});

i 希望你的问题能够得到解决

在我的经验中,对骑士团编辑的鉴定有两个问题。 首先,CMCE对内容进行缓冲,因此,编辑所看到的 j字体形形形形形色色。 其次,通过分类鉴定发现的文字区隐藏着锡克族社区中心结构中的一些深度。 当jquery的验证在该文本之后发出错误信息时,错误信息也是隐蔽的。

There are two separate jquery validation features that can resolve these issues: Normalizers: allow you to transform the contents of a field before validation Error Placement: allows you to modify where the error is displayed in the DOM. Both of these can be configured globally through the setDefaults method as such:

 jQuery.validation.setDefaults({
    normalizer:function(val){
        var ele = jQuery(this);
        if(window.tinyMCE.editors[ele.id]){
            window.tinyMCE.editors[ele.id].save();
            return window.tinyMCE.editors[ele.id].getContents();
        }
        return val;
    },
    errorPlacement:function(error,element)
    {
        var ele = jQuery(element);
        if(window.tinyMCE.editors[ele.id]){
            var realTarget = window.tinyMCE.editors[ele.id].getContainer().parent();
            error.insertAfter(realTarget);
        }
        error.insertAfter(element);
    }
});

相反,你可以使用丁胺醇/编码方法。

Ref:

<>Usage>

tinyMCE.activeEditor.isDirty()

Hope this helps





相关问题
Bind Button.IsEnabled to custom validation with XAML?

I am sorry I didn t know how to title my question any better, you name it if you got a good 1. I have an entity Contact. this person has navigation properties: Address, Phones (A collection of Phone)....

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

Rails 101 | validates_currency?

I ve searched high and low, but I could not find a solution, to what I think seems like a very common task. In a form I want to have a text input that accepts currency strings (i.e. $1,000,000 or ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签