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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:50:42+00:00 2026-05-28T15:50:42+00:00

When I create a new MVC3 application, add a model, add a [Required] attribute

  • 0

When I create a new MVC3 application, add a model, add a [Required] attribute to the model, scaffold a new edit view for this model, and add a @Html.ValidationMessageFor(...), everything works beautifully. If I attempt to submit the edit form without filling in a value it gives me a validation message.

My problem is that this is not working in the enterprise app I’m working on. Here’s what I’ve done and I wonder if you can think of anything else I can check to troubleshoot. I can’t share the code, but perhaps you can see an obvious omission from the list…

  • Add [Required] attribute to my model’s property
  • Make sure jquery.validate.js and jquery.validate.unobtrusive.js are referenced
  • Added Html.EnableClientValidation(true) and Html.EnableUnobtrusiveJavaScript(true) on my view
  • Added my @Html.ValidationMessageFor(...) next to my control (which is a @Html.TextBoxFor)

The issue is that I can submit the form and no validation is performed. I get a server-side error stating that the entity is not valid, which I would expect if it gets past the client-side validation.

When I inspect the source, it has not rendered the validation attributes to my textbox. I would expect it to look something like this…

<input class="text-box single-line" data-val="true" 
    data-val-required="The Property1 field is required." 
    id="Property1" name="Property1" type="text" value="" />

But instead it looks more like this…

<input id="Reminder_Description" name="Reminder.Description" 
    style="width:300px;" type="text" value="" />

What exactly is responsible for injecting those attributes?

Thanks!

  • 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-05-28T15:50:42+00:00Added an answer on May 28, 2026 at 3:50 pm

    I figured out the issue. I just didn’t know that attributes are not passed through a service layer (WCF), so the Required attribute was not effective. To remedy, we added a local reference to the entities assembly (which makes sense in our architecture). Thanks.

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

Sidebar

Related Questions

Whenever I create a new Empty MVC3 Web Application project in Visual Studio 2010
I create new ASP.NET web application that use SMTP to send message. The problem
I have a new MVC3 application with a few legacy Web Form pages. I'm
I am fairly new to unit testing. I am building an ASP.NET MVC3 application
I have a View in my MVC3 application which displays one of two pretty
I'm kinda new to all this MVC3 stuff, and in many terms programming. The
I have problem with create ulr routing for asp.net mvc3 application. My project has
I create new desktop with CreateDesktop and want to get it's DC & RC.
How to create new PCL file similar to existing MS doc. I have MS
I am attempting to create new membership users in an Ektron CMS400.NET-based website by

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.