I have two submit buttons and a few textboxes on my page. When I enter details in the textbox and hit the enter button the form should actuate the start new button. But the form is actuating the old button. I don't want to add on click to button because I am checking some conditions and redirecting from my controller. What do I have to do to avoid my form from actuating by default for old value button on hitting the enter button any suggestions, please?
controller :
public ActionResult Index(MyModel model, string new, string old)
{
if (new == "new")
{
if (rows > 0)
{
return ProcessAction();
}
else
{
return ProcessAction();
}
}
if (old == "old")
{
if (rowsAmount > 0)
{
//do something
}
else
{
//do something
}
}
return View();
}
View:
@using (Html.BeginForm("Index", "Application", FormMethod.Post))
{
@Html.AntiForgeryToken()
}
Run code snippetExpand snippet
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)