Readonly fields don't seem to work on iOS. This is what I have:
@Html.EditorFor(model => model.DateOfBirth, new { htmlAttributes = new { @readonly = "true" } })
Essentially, this gets translated to this:
<input type="date" readonly="readonly" />
Works on Windows Chrome, but does does not work on the iPhone. Still able to edit the field. The date picker shows up.
This is actually a bug in iOS, a readonly date field is still changeable.
You can fix it by adding something like this to the HTML:
onclick="this.blur()"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With