# AutoComplete submits the TemplateForm on key Enter

**URL:** <https://forum.radzen.com/t/autocomplete-submits-the-templateform-on-key-enter/9788>\
**Category:** Radzen.Blazor Components\
**Created:** [January 4, 2022, 9:49pm UTC](https://forum.radzen.com/t/autocomplete-submits-the-templateform-on-key-enter/9788 "2022-01-04T21:49:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucian\_Naie](https://forum.radzen.com/user_avatar/forum.radzen.com/lucian_naie/32/8276_2.png) [@Lucian\_Naie](https://forum.radzen.com/u/Lucian_Naie)\
**Post date:** [January 4, 2022, 9:49pm UTC](https://forum.radzen.com/t/autocomplete-submits-the-templateform-on-key-enter/9788/1 "2022-01-04T21:49:25Z")

</div>

Hello,

I have an AutoComplete control inside a TemplateForm with a regular setup we see all over in the samples.  
Today I noticed that when I press enter in AutoComplete, it does submit the form. And yes, I don't want to, because I also have a Submit button that should be used for that purpose.  
I don't see anything obvious in the API docs: [https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAutoComplete.html](https://blazor.radzen.com/docs/api/Radzen.Blazor.RadzenAutoComplete.html)

Any suggestions for how to turn this default behavior off or work around it?

Regards,  
Lucian

---

<div class="post-metadata">

**Author:** ![enchev](https://forum.radzen.com/user_avatar/forum.radzen.com/enchev/32/16_2.png) [@enchev](https://forum.radzen.com/u/enchev)\
**Post date:** [January 5, 2022, 6:59am UTC](https://forum.radzen.com/t/autocomplete-submits-the-templateform-on-key-enter/9788/2 "2022-01-05T06:59:56Z")

</div>

> [@Pressing enter in text boxes triggers save](http://forum.radzen.com/t/pressing-enter-in-text-boxes-triggers-save/3711/4):
>
> In HTML standard form with submit button is submitted on enter key by default. Here is the specification: [https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission)

---

<div class="post-metadata">

**Author:** ![Lucian\_Naie](https://forum.radzen.com/user_avatar/forum.radzen.com/lucian_naie/32/8276_2.png) [@Lucian\_Naie](https://forum.radzen.com/u/Lucian_Naie)\
**Post date:** [January 5, 2022, 9:05am UTC](https://forum.radzen.com/t/autocomplete-submits-the-templateform-on-key-enter/9788/3 "2022-01-05T09:05:34Z")

</div>

Yes, that's correct. It happens for all input controls.  
Then the solution would be no implicit submit button. I forgot about this HTML feature. 🙂  
But it requires to js interop call the form.submit() programmatically, then handle the submit event on the form and prevent the default behavior, then interop callback into blazor TemplateForm to do the validation and eventually call the Submit callback handler. Uh oh, a lot of work.  
Thanks.

---

<div class="post-metadata">

**Author:** ![iliyan.kulishev](https://forum.radzen.com/user_avatar/forum.radzen.com/iliyan.kulishev/32/9198_2.png) [@iliyan.kulishev](https://forum.radzen.com/u/iliyan.kulishev)\
**Post date:** [January 5, 2022, 11:07am UTC](https://forum.radzen.com/t/autocomplete-submits-the-templateform-on-key-enter/9788/4 "2022-01-05T11:07:48Z")

</div>

If submit button is a must then include this in the RadzenAutoComplete:

onkeydown="return event.keyCode !== 13"

This is plain JS, no @ symbol.
