Asp.net MVC renders 2 "form action" statements for the same form when in responsive mode

Jean Vallee 21 Reputation points
2024-04-29T18:06:54.7466667+00:00

ASP.Net MVC VS 2022 Windows 11

App runs fine in desktop mode.

This line:

<@using (@Html.BeginForm("SubmitForm", "Home", FormMethod.Post, new { id = "subform", verify = "Y" }))>

is generated correctly as:

<form action="/Home/SubmitForm" id="subform" method="post" verify="Y">

when I inspect the page.

However, if I try to emulate a cell phone, the generated cshtml is:

<form action="/Home/SubmitForm" id="subform" method="post">

<form action="javascript:submitform()" method="POST" style="display:none;visibility:hidden;">

There is no javascript function called "submitform" so of course it fails.

What I have tried:

I did add an empty "submitform" function but that did not solve the issue.

How do I stop this javascript form action statement from being generated at all?

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,298 questions
{count} votes