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 8686587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:53:24+00:00 2026-06-12T22:53:24+00:00

I have the following View in MVC and I get the warning message: Validation

  • 0

I have the following View in MVC and I get the warning message: Validation (HTML5): Element 'legend' occurs too few times

@model Berwin.Models.ViewModels.UserViewModel

@{
ViewBag.Title = "Press";
}

<h2>Press Area</h2>

@using (Html.BeginForm("Register", "PressController", FormMethod.Post))
{
<fieldset>
    @Html.TextBoxFor(model => model.FullName)
</fieldset>

<fieldset>
    @Html.TextBoxFor(model => model.Company)
</fieldset>

<fieldset>
    @Html.TextBoxFor(model => model.EmailAddress)
</fieldset>

<fieldset>
    @Html.CheckBoxFor(model => model.JoinMailingList)
</fieldset>
}

Would like to know why I am getting this warning and what I need to do to fix this.

  • 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-12T22:53:25+00:00Added an answer on June 12, 2026 at 10:53 pm

    To prevent Visual Studio incorrectly warning you that the "Element 'legend' occurs too few times" you need to correct Visual Studio’s HTML and XHTML validation files.

    VS will then treat the <legend> tag as optional inside a <fieldset> tag (as per the spec).

    To do so, there are two files you need to edit: html_5.xsd and xhtml_5.xsd. For VS2010 these are found in (e.g.):

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\schemas\html\

    Steps to take:

    1. Close Visual Studio

    2. Using a text editor open the file html_5.xsd found in the folder above.

    3. Locate the following line:

      (note there are two lines which are similar, the first is correct, the second needs editing):

      <xsd:element name="legend" type="legendType" minOccurs="1" maxOccurs="1" />

    4. Edit the line to read:

      <xsd:element name="legend" type="legendType" minOccurs="0" maxOccurs="1" />

    5. Save the file

    6. Repeat the process for the file xhtml_5.xsd which is in the same folder

    Now start Visual Studio and view your HTML5 file – the warning will be gone.

    I hope that helps others, and I hope the .xsd files will be corrected in a future update.

    UPDATE:

    The line you need to find may be:

    <xsd:element ref="legend" minOccurs="1" maxOccurs="1" vs:firstchild="true"/>

    If so, change the minOccurs="1" attribute to minOccurs="0"

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

Sidebar

Related Questions

I have the following view definition in my asp.net mvc website: <% Using Ajax.BeginForm(UsrCtlChangePassword,
I have an ASP MVC view where have the following statement #if DEBUG //section
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
in a partial view I have the following: <%Html.RenderAction(MVC.User.GetComments(Model.UserGroupName)); %> can I render a
I have the following View, Controller and Comment.cs code, but I get an error,
I have the following form on an .NET MVC View: <form method=post enctype=multipart/form-data action=/Video/UploadDocument>
I have the following in my MVC View: @Html.TextBoxFor(model => model.FromDateCollected, new { style
I have the following in my MVC View: <a href='@Url.Action(EmailPerson, SupportNeeded)'> Email </a> Below,
I have the following in my ASP.Net MVC 3 Razor View @foreach (var item
I have a page: <%@ Page Inherits=System.Web.Mvc.View<DTOSearchResults> %> And on it, the following: <%

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.