How to show validation error messge on different location?

后端 未结 1 2051
遥遥无期
遥遥无期 2021-02-05 08:07

I am using knockout.js & knockout.validation plugins. I am adding the example fiddle

http://jsfiddle.net/hsnCW/1/

In this example there is a cu

相关标签:
1条回答
  • 2021-02-05 08:43

    You can use the validationMessagebinding to display any of your proerties error message:

    <p data-bind="validationMessage: newItem"></p>
    

    And you can disable the automatically inserted validation message with the validationOptions binding:

    <span data-bind="validationOptions: { insertMessages: false}">New Item: 
        <input data-bind="value:newItem" /> 
        <button data-bind="click: addItem">Add</button>
    </span>
    

    See the documentation Validation Bindings section for more info.

    Demo JSFiddle.

    0 讨论(0)
提交回复
热议问题