简体   繁体   English

剔除验证忽略输入字段的errorsAsTitle配置

[英]knockout validation ignores errorsAsTitle config for input field

I'm using knockout (3.0.0) with validation (1.0.2), trying to disable "tooltips" which ko-validation generates for a field when it contains an error: 我正在使用带有验证(1.0.2)的剔除(3.0.0),试图禁用ko-validation在包含错误时为字段生成的“工具提示”:

在此处输入图片说明

Based on documentation , errorsAsTitle:false should prevent tooltips from displaying, but it seems to ignore false . 根据文档errorsAsTitle:false应该阻止显示工具提示,但是似乎忽略了false

Fiddle illustrating the issue 小提琴说明问题

My current configuration 我当前的配置

  ko.validation.rules.required.message = 'Field(s) are required!';

  ko.validation.configure({
      registerExtenders: true,
      messagesOnModified: true,
      errorsAsTitle: false,  //<-----problem here
      insertMessages: false,
      decorateElement: true,
      errorElementClass: 'inputError'
  });

  function ViewModel() {
      this.name = ko.observable("").extend({
          required: true
      });
  };

  ko.applyBindings(new ViewModel());

在最新版本上,请使用decorateInputElement而不是decorateElement

Works with latest version on github 在github上使用最新版本

http://jsfiddle.net/q4QCY/56/ http://jsfiddle.net/q4QCY/56/

Version on that cdn is old

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM