Skip to content

Commit 1be6b42

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 91921a3 commit 1be6b42

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

docs/api/javascript/ui/form.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,38 @@ Prepares the widget for safe removal from DOM. Detaches all event handlers and r
11341134
form.destroy();
11351135
</script>
11361136

1137+
## Fields
1138+
1139+
### validator `kendo.ui.Validator`
1140+
1141+
The [Validator instance](/api/javascript/ui/validator).
1142+
1143+
#### Example - use the validator API
1144+
1145+
<form id="myForm"></form>
1146+
1147+
<script>
1148+
var form = $("#myForm").kendoForm({
1149+
formData: {
1150+
ID: 1,
1151+
Name: "",
1152+
Address: ""
1153+
},
1154+
items: [{
1155+
field: "Name",
1156+
label: "Name:",
1157+
validation: { required: true }
1158+
}, {
1159+
field: "Address",
1160+
label: "Address:",
1161+
validation: { required: true }
1162+
}]
1163+
}).data("kendoForm");
1164+
1165+
form.validator.validateInput("[name='Name']");
1166+
form.validator.validateInput("[name='Address']");
1167+
</script>
1168+
11371169
## Events
11381170

11391171
### validate

docs/controls/layout/form/validation.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,36 @@ The following example demonstrates custom validation of the `RetireDate` field.
201201
</script>
202202
```
203203

204+
## Using the Validator Instance
205+
206+
The Kendo Ui Form utilizes the [Kendo UI Validator component](https://demos.telerik.com/kendo-ui/validator) internally. This behavior facilitates use cases, in which you may need to use the [Validator API](/api/javascript/ui/form)&mdash;for example, to programmatically trigger validation.
207+
208+
```dojo
209+
<form id="myForm"></form>
210+
211+
<script>
212+
var form = $("#myForm").kendoForm({
213+
formData: {
214+
ID: 1,
215+
Name: "",
216+
Address: ""
217+
},
218+
items: [{
219+
field: "Name",
220+
label: "Name:",
221+
validation: { required: true }
222+
}, {
223+
field: "Address",
224+
label: "Address:",
225+
validation: { required: true }
226+
}]
227+
}).data("kendoForm");
228+
229+
form.validator.validateInput("[name='Name']");
230+
form.validator.validateInput("[name='Address']");
231+
</script>
232+
```
233+
204234
## See Also
205235

206236
* [Validation of the Form (Demo)](https://demos.telerik.com/kendo-ui/form/validation)

0 commit comments

Comments
 (0)