Smart UI Components & Libraries – Grid, Scheduler, Gantt, Kanban for Angular, React, Next.js, Vue, Blazor, JavaScript › Forums › General Discussions › Buttons › How to custom the submit function of a form
Tagged: form submit, form submit button, form submittion
- This topic has 4 replies, 2 voices, and was last updated 5 years, 3 months ago by
admin.
-
AuthorPosts
-
August 16, 2020 at 4:08 pm #100966
admin
KeymasterI don’t want to post when I submit , I want to use my custom function inside my component when I used:
<div>
<div><smart-form-control</div>
<div> align=”right”</div>
<div> control-type=”submit”</div>
<div> label=”Submit”</div>
<div> class=”primary”</div>
<div> ></smart-form-control></div>
</div>
There is a possibility to do something like that:
<div>
<div><smart-form-control</div>
<div> align=”right”</div>
<div> control-type=”submit”</div>
<div> label=”Submit”</div>
<div>
<div>
<div> (click)=”submit()”</div>
</div>
</div>
<div> class=”primary”</div>
<div> ></smart-form-control></div>
</div>August 16, 2020 at 4:53 pm #100967admin
KeymasterHi yb,
If you do not define a submit button in your Form, you can manually submit it by calling form.submit();
Hope this helps.
Best regards,
Peter Stoev
Smart HTML Elements
https://www.htmlelements.com/August 17, 2020 at 7:36 am #100969admin
KeymasterI wanted to use the button of the library and specify with function to call something likee that:
<smart-form-control align="right" control-type="button" label="Submit" class="primary" (click)="myFunc($event)"></smart-form-control>August 17, 2020 at 8:43 pm #100977admin
KeymasterHi yb,
You can create the Form like that: https://www.htmlelements.com/angular/demos/form/template/ by using the same initialization process like in Angular Reactive Forms. Then you might not set the button’s ‘action’ property so your button will not submit the Form.
Another possible solution is to use Angular Reactive Forms directly. Our Angular components are integrated with Angular Reactive Forms and also with the Template Driven Forms so you have options here. An example of such integration is: https://www.htmlelements.com/angular/demos/dropdownlist/reactiveforms/.
Best regards,
Peter Stoev
Smart HTML Elements
https://www.htmlelements.com/August 18, 2020 at 2:34 pm #100982admin
Keymasterok thanks
-
AuthorPosts
- You must be logged in to reply to this topic.