Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8298097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:38:53+00:00 2026-06-08T15:38:53+00:00

Below is my view page. without <form> tag when I insert the values, its

  • 0

Below is my view page. without <form> tag when I insert the values, its perfectly inserting. But when I insert with <form> tag the values not inserting, the debug point pointing to [HttpGet] instead of [HttpPost]. For validation purpose I have inserted the <form> tag. But it seem to be no use.. Tell me the solution….

@model CustMaster.Models.MyAccount
@using CustMaster.Models

@{
    ViewBag.Title = "Customer Information";
}    

<html>
<head>
   <title>Customer Information</title>
   <link href="../../style.css" rel="stylesheet">     
</head>
<body>

<form action="" id="contact-form" class="form-horizontal">

   @using (Html.BeginForm())
   {        
      <table>
        <tr>
           <td><h3>User Information</h3></td>
        </tr>
      </table>
      <table>
         <tr>
            <td>
             <div class="control-group">

               @Html.LabelFor(model => model.CustomerFirstName, 
               new { @class = "control-label" })

                <div class="controls">
                   @Html.TextBoxFor(model => model.CustomerFirstName, 
                   new { @class = "input-xlarge" })

                </div> 
             </div>
           </td>

          <td>
             <div class="control-group"> 

               @Html.LabelFor(model => model.CustomerMiddleName, 
               new { @class = "control-label" })

                <div class="controls">
                     @Html.TextBoxFor(model => model.CustomerMiddleName, 
                     new { @class = "input-xlarge" })
                </div>
             </div>
         </td>
      </tr>     
 </table>
 <button type="submit">Register</button>
}
@*</form>*@

   <script type="text/javascript" src="../../assets/js/jquery-1.7.1.min.js"></script>   
   <script type="text/javascript" src="../../assets/js/jquery.validate.js"></script>   
   <script type="text/javascript" src="../../assets/js/jquery.validate.min.js"></script>   
   <script type="text/javascript" src="../../script.js"></script>   

</body>
</html>

Below is my Controller

[HttpGet]
public ActionResult Index()
{
   return View();
}

[HttpPost]
public ActionResult Index(MyAccount myacc)
{
   MyAccount ma = new MyAccount();
   var objview = ma.GetCustInfo(myacc);
   return View();            
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T15:38:54+00:00Added an answer on June 8, 2026 at 3:38 pm

    You cannot nest html forms => it results in invalid markup and undefined behavior. You will have to remove the outer <form>. The Html.BeginForm already generates a form tag. You seem to have commented the closing form tag but not the opening.

    And please format your code a little. It’s a complete mess to read:

    @model CustMaster.Models.MyAccount
    @using CustMaster.Models
    
    @{
        ViewBag.Title = "Customer Information";
    }
    
    <html>
    <head>
        <title>Customer Information</title>
        <link href="@Url.Content("~/style.css")" rel="stylesheet">
    </head>
    <body>
        @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "contact-form" })) 
        {
            <table>
                <tr>
                    <td><h3>User Information</h3></td>
                </tr>
            </table>
            <table>
                <tr>
                    <td>
                        <div class="control-group">
                           @Html.LabelFor(model => model.CustomerFirstName, new { @class = "control-label" })
                           <div class="controls">
                               @Html.TextBoxFor(model => model.CustomerFirstName, new { @class = "input-xlarge" })
                           </div> 
                       </div>
                   </td>
                   <td>
                       <div class="control-group">
                           @Html.LabelFor(model => model.CustomerMiddleName, new { @class = "control-label" })
                           <div class="controls">
                               @Html.TextBoxFor(model => model.CustomerMiddleName, new { @class = "input-xlarge" })
                           </div>
                       </div>
                   </td>
               </tr>
           </table>
    
           <button type="submit">Register</button>
        }
    
        <script type="text/javascript" src="@Url.Content("~/assets/js/jquery-1.7.1.min.js")"></script>   
        <script type="text/javascript" src="@Url.Content("~/assets/js/jquery.validate.js")"></script>   
        <script type="text/javascript" src="@Url.Content("~/assets/js/jquery.validate.min.js")"></script>   
        <script type="text/javascript" src="@Url.Content("~/script.js")"></script>
    </body>
    </html>
    

    Also please notice that I have fixed your script references by introducing url helpers instead of hardcoding the url to them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Below is my example script: <li><a <?php if ($_GET['page']=='photos' && $_GET['view']!==projects||!==forsale) { echo (href=\#\
I wanted to generate a list view using below code. But after running this
I am solving how to pass values from one page to another without making
I tried below code in .htaccess with my Joomla site but it is not
Say, I've two overlapping UIView layers: ----view-top --view-below When I touch the screen, I
In the MVC View code below, isLoggedInDb is underlined in green with a tooltip
How can I optimize below SQL (simplified view of my complex query.) Ideally, I
Suppose I have the view models below. public class CustomerListViewModel { public IEnumerable<CustomerViewModel> Customers
In the method CreateView() (check my View Engine below) or in my custom action
I was going over some old C code (listed below) with a view to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.