Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Created Unassigned: Client validation ignores what we specify in DataFormatString. [1304]

$
0
0
Let's say I have a property called MyDate in Model.

```
[Required]
[DataType(DataType.Date)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
[Display(Name = "My Date")]
public DateTime MyDate { get; set; }
```

I have the following code in View.

```
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary()

<fieldset>
<legend>Registration Form</legend>
<ol>
<li>
@Html.LabelFor(m => m.MyDate)
@Html.TextBoxFor(m => m.MyDate)
</li>
</ol>
<input type="submit" value="Register" />
</fieldset>
}
```

Note that I don't want to use EditorFor or other for now. I just like to focus on what TextboxFor, Client validate and date format are not working at this moment.

__Problem:__ The problem is that the client validation doesn't care about the format that we specify. It will show the error when we enter the date like "18/8/2012" or "18/08/2012"

I am using VS 2012, .NET 4.5 and MVC 4.

When I google, seems like a lot of people are having the same issue and some people suggested to use the JS to workaround the issue.

Is this the known issue? If yes then when you guys plan to release the fix? if not, please let me know how to make it work.

Thanks!

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>