https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation?view=aspnetcore-2.1
http://bradwilson.typepad.com/blog/2010/10/mvc3-unobtrusive-validation.html
https://blogs.msdn.microsoft.com/mvpawardprogram/2017/01/03/asp-net-core-mvc/
https://thewayofcode.wordpress.com/2012/01/18/custom-unobtrusive-jquery-validation-with-data-annotations-in-mvc-3/
Jul 18, 2018
Jul 10, 2018
ASP.NET Core custom validation for required on file upload or radio - dirty way
In some cases like radio group or file upload buttons standard Required validation with JQuery don't work.
There is legit way of registering custom validation attributes for both serves side Model and for client side.
This is dirty way ...
Just create in doom so small that is not visible (NOT HIDDEN! ) input with same dom name.
If you hide it JQuery validation will ignore it. Through JQ apply changes to real input on the hidden one.
There is legit way of registering custom validation attributes for both serves side Model and for client side.
This is dirty way ...
Just create in doom so small that is not visible (NOT HIDDEN! ) input with same dom name.
<span asp-validation-for="ImageRaw" style="padding-left:15px" class="text-danger"></span>
<input style="width:0px;border:0px!important;padding:0px;" type="text" asp-for="ImageRaw" />
If you hide it JQuery validation will ignore it. Through JQ apply changes to real input on the hidden one.
$(document).on('change', 'input[name="PersonImage"]', function () {$('input#ImageRaw').val($(this).val());});
Subscribe to:
Posts (Atom)