Вопрос

I have tried to apply required attribute in HTML5 , for validation. I implemented the logic of MVVM in my screen,

I invoked validator.validate() as well, and its working fine, but i am not getting the notification for the same near my control.

  <input class="input-block-level" type="text" id="txtSupplierName" data-bind="value: SupplierName" 
                    placeholder="Supplier Name" required  validationMessage="Supplier Name required {0}"/>

validator

 validator = $("#supplierForm").kendoValidator().data("kendoValidator");

please suggest , at present i am handling in validator.validate() if true go ahead , if false the stop and show alert.

Это было полезно?

Решение

This was a while back, but I hope this resolves your issue:

Add a span after the input. Use the 'data-for' attribute, and pass it the name of your input control (also, add a name to your input control).

<span class="k-invalid-msg" data-for="txtSupplierName"></span>

The css class is a kendo class, so use your own styling if not using kendo templates.

Другие советы

You try with data-required-msg:

<input class="input-block-level" type="text" id="txtSupplierName" data-bind="value:    SupplierName" 
                placeholder="Supplier Name" required  data-bind="attr:{data-required-msg:message}"/>

JS:

kendo.observable({
message:"Supplier Name required"
});
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top