{"action":"opened","issue":{"url":"https://api.github.com/repos/aspnet/Mvc/issues/4630","repository_url":"https://api.github.com/repos/aspnet/Mvc","labels_url":"https://api.github.com/repos/aspnet/Mvc/issues/4630/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Mvc/issues/4630/comments","events_url":"https://api.github.com/repos/aspnet/Mvc/issues/4630/events","html_url":"https://github.com/aspnet/Mvc/issues/4630","id":154684729,"number":4630,"title":"Wrong Custom error message in server side validation for MVC6 TagHelper","user":{"login":"vigneshc91","id":2412864,"avatar_url":"https://avatars.githubusercontent.com/u/2412864?v=3","gravatar_id":"","url":"https://api.github.com/users/vigneshc91","html_url":"https://github.com/vigneshc91","followers_url":"https://api.github.com/users/vigneshc91/followers","following_url":"https://api.github.com/users/vigneshc91/following{/other_user}","gists_url":"https://api.github.com/users/vigneshc91/gists{/gist_id}","starred_url":"https://api.github.com/users/vigneshc91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vigneshc91/subscriptions","organizations_url":"https://api.github.com/users/vigneshc91/orgs","repos_url":"https://api.github.com/users/vigneshc91/repos","events_url":"https://api.github.com/users/vigneshc91/events{/privacy}","received_events_url":"https://api.github.com/users/vigneshc91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-13T10:47:55Z","updated_at":"2016-05-13T10:47:55Z","closed_at":null,"body":"In the MVC6 TagHelper i have created two text box and binded model for that with custom error message one textbox of type string and other of type int during the post back the custom error message specified in the data annotation is not rendered properly for type other than string.\r\n\r\nMy Controller is\r\n\r\n```\r\npublic class HomeController : Controller\r\n{\r\n    public IActionResult Index()\r\n    {\r\n        return View();\r\n    }\r\n\r\n    [HttpPost]\r\n    public IActionResult Index(Sample model)\r\n    {\r\n        return View(model);\r\n    }\r\n}\r\n```\r\n\r\nThe Model class is\r\n\r\n```\r\npublic class Sample\r\n{\r\n    [Required(ErrorMessage = \"String value is needed\")]\r\n    public string StringValue { get; set; }\r\n\r\n    [Required(ErrorMessage = \"Int value is needed\")]\r\n    public int IntValue { get; set; }\r\n\r\n}\r\n```\r\n\r\nAnd My Html Tag Helper code is\r\n\r\n```\r\n@model ValidationMessage.Models.Sample\r\n<form method=\"post\" action=\"/Home/Index\">\r\n    <label>String</label>\r\n    <input asp-for=\"StringValue\" type=\"text\" />\r\n    <span asp-validation-for=\"StringValue\"></span>\r\n    <br />\r\n\r\n    <label>Int</label>\r\n    <input asp-for=\"IntValue\" type=\"text\" />\r\n    <span asp-validation-for=\"IntValue\"></span>\r\n    <br />\r\n\r\n    <input type=\"submit\" />\r\n</form>\r\n```\r\n\r\nHere am checking the server side validation alone, If i click the submit button the first text box span validation shows String value is needed but the second text box span validation shows The value '' is invalid. instead of Int value is needed.\r\n\r\nMaking the model property to nullable working as expected, but i cannot give nullable property in all cases. Is it possible to make it work without making it as nullable because in MVC5 its working fine."}}