This is a migrated thread and some comments may be shown as answers.

New Form Widget, how to cancel a form.

1 Answer 153 Views
Form
This is a migrated thread and some comments may be shown as answers.
Lance
Top achievements
Rank 1
Lance asked on 21 May 2020, 12:36 PM
How does one do a 'Cancel' on a Form widget. I see the events for Submit / Clear / Validate. It looks like the only way to leave a form is to submit it.

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 22 May 2020, 05:41 AM

Hello Lance,

I am not sure that I understand the scenario correctly. Therefore, could you elaborate a bit more what exactly are you trying to achieve?

Generally speaking, the Form renders a "Submit" and "Clear" button by default, that could be replaced through a template if needed where a custom button could be rendered. This can be achieved through the .ButtonsTemplateId() option:

@(Html.Kendo().Form<Kendo.Mvc.Examples.Models.Form.UserViewModel>()
  .Name("formExample")
  ...
  .ButtonsTemplateId("formButtons")
)

<script id="formButtons" type="text/x-kendo-template">
  <button class="custom-btn">Custom Action</button>
</script>

With the above setup you can wire a click handler to the custom button and execute specific logic when clicked.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Form
Asked by
Lance
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or