Skip to content

Commit 67f6e06

Browse files
author
Kendo Bot
committed
Sync with Kendo UI Professional
1 parent 5059435 commit 67f6e06

File tree

3 files changed

+70
-4
lines changed

3 files changed

+70
-4
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
title: Add Custom Reset Button to Form
3+
description: An example on how to add a reset button to the Form.
4+
type: how-to
5+
page_title: Add Custom Reset Button to Form
6+
slug: form-custom-reset-button
7+
tags: form, reset, setoptions
8+
res_type: kb
9+
---
10+
11+
## Environment
12+
13+
<table>
14+
<tr>
15+
<td>Product</td>
16+
<td>Progress Kendo UI Form</td>
17+
</tr>
18+
</table>
19+
20+
## Description
21+
22+
How can I add a custom button to reset the inital data loaded in the From?
23+
24+
## Solution
25+
26+
Configure a `buttonsTemplate` and add the html for the reset button. On click of the custom reset button, get a reference to the Form. Use the [setOptions](/api/javascript/ui/form/methods/setoptions) method to set the formData of the Form to the initial data.
27+
28+
```dojo
29+
<form id="myForm"></form>
30+
31+
<script>
32+
function custom(){
33+
var form = $("#myForm").data('kendoForm');
34+
var initial = form.options.formData;
35+
form.setOptions({
36+
formData: {
37+
ID: initial.ID,
38+
Name: initial.Name,
39+
Address: initial.Address
40+
}
41+
});
42+
}
43+
44+
$(document).ready(function(){
45+
$("#myForm").kendoForm({
46+
formData: {
47+
ID: 1,
48+
Name: "Ivan",
49+
Address: "Sofia"
50+
},
51+
buttonsTemplate:'<div class="k-form-buttons">'+
52+
'<button class="k-button k-primary k-form-submit" type="submit">Submit</button>'+
53+
'<button class="k-button k-form-clear">Clear</button>'+
54+
'<button id="btn" onclick="custom()" class="k-button">Custom Reset button</button>'+
55+
'</div>',
56+
submit: function(e) {
57+
e.preventDefault();
58+
}
59+
});
60+
})
61+
</script>
62+
```
63+
64+
## See Also
65+
66+
* [Form Overview](https://docs.telerik.com/kendo-ui/controls/layout/form/overview)

docs/knowledge-base/form-set-form field-programmatically.md renamed to docs/knowledge-base/form-set-field-programmatically.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@ Get a reference to the Form instance and set the value of the required model fie
121121
function onDdlChange(e){
122122
var form = $("#exampleForm").getKendoForm();
123123
var dataItem = e.sender.dataItem();
124-
125-
form._model.set("City", dataItem.ShipCity);
126-
form._model.set("AddressLine", dataItem.ShipAddress);
124+
125+
form.editable.options.model.set("City", dataItem.ShipCity);
126+
form.editable.options.model.set("AddressLine", dataItem.ShipAddress);
127127
};
128128
129129
});

docs/styles-and-layout/appearance-styling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ The Theme Builder generates CSS, Less, and JS code which is compatible with the
203203

204204
### Modifying Themes
205205

206-
Kendo UI supports a number of `.less` files, which are only used when you want to modify the Kendo UI CSS source code and create a custom theme. In the Kendo UI Q1 2014 release, the Kendo UI `web.common.less` file was split, which resulted in the construction of `.less` files for each widget. The Kendo UI mobile platform themes were also divided in parts to create files per widget. The Kendo UI `.less` files, including the styling of the Kendo UI hybrid widgets, can be built by using the Less 1.7.5 version.
206+
Kendo UI supports a number of `.less` files, which are only used when you want to modify the Kendo UI CSS source code and create a custom theme. In the Kendo UI Q1 2014 release, the Kendo UI `web.common.less` file was split, which resulted in the construction of `.less` files for each widget. The Kendo UI mobile platform themes were also divided in parts to create files per widget. The Kendo UI `.less` files, including the styling of the Kendo UI hybrid widgets, can be built by using the Less 3.0.0 version.
207207

208208
> * As of 2019.1 versions and onwards Kendo UI for jQuery distributes a single and identical set of themes for both Kendo UI Professional and Kendo UI Core.
209209
> * Kendo UI versions earlier than and including 2015.2.805 had to be built with [Telerik Less fork](https://github.com/telerik/less.js) located on GitHub. This is no longer a requirement.

0 commit comments

Comments
 (0)