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

  • SEARCH
  • Home
  • 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 8912267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:09:25+00:00 2026-06-15T04:09:25+00:00

I have a problem with form tags in a foreach loop in razor when

  • 0

I have a problem with form tags in a foreach loop in razor when it render the output html is wrong because in the first iteration the form tags disappear here is the razor code

@foreach (var item in Model)
        {



            <tr>

                <td>@if (item.IsMandatory)
                    {
                        <span class="label label-important">Obligatorio</span>
                    }
                    else
                    {
                        <span class="label">Opcional</span>
                    } </td>

                <td>@Html.DisplayFor(modelItem => item.DocumentName)</td>
                <td>



                </td>
                <td>
                    <form>
                        form here!
                    </form>

                </td>
             </tr>

        }

here is the rendered html:

 <table class="table table-striped">
  <thead>
     <tr>
         <th>Requerido</th>
         <th>Documento</th>
         <th>Accion</th>
    </tr>
</thead>    
 <tbody>
    <tr>
      <td>
      <span class="label label-important">Obligatorio</span>
     </td>
     <td>Copia de cédula</td>
      <td>
       here form!    <----------Problem Here
      </td>
    </tr>
     <tr>
      <td>
     <span class="label label-important">Obligatorio</span>
     </td>
      <td>
        Copia de otro documento de identidad (licencia, pasaporte, seguro)
     </td>
      <td>
        <form novalidate="novalidate">
                 here form!
         </form>

      </td>
  </tr>

  • 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-15T04:09:26+00:00Added an answer on June 15, 2026 at 4:09 am

    You’re probably trying to start a new tag inside an existing one, like this:

    <form id="mainPageForm">
    @foreach(item in items)
    {
        <form id="nestedForm@(item.FormId)">
    }
    </form>
    

    Which results in something like this:

    <form id="mainPageForm">
      <form id="nestedForm1"></form>  --> this ends the first form
      <form id="nestedForm2"></form>  --> correctly formed
      <form id="nestedForm3"></form>  --> correctly formed
    </form> --> closing tag without parent
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a HTML Form contains input text fields and select tags.In jQuery I
We have form tags like below in our HTML pages: <form method= POST action=https://mysite_1.com>
I have problem SIMILAR to preventing form data reposting, but not quite the same
I have problem with a long form in iOS. The form itself is done
I have problem with show or hide form in Window Form Application. I start
I have a problem with dojox.form.Uploader. I want to use it to attach files
I have problem with TinyMCE editor. I have form with few text fields and
I have problem in declaring the intents on my app. I have a form
I have a problem with RequireFieldValidator in my form. When I fill badly the
I have a little problem with javascript form submit issue, here is the script

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.