Hey,
So I've been using the asp.net core kendo and it is great but I cannot seem to get over one hurdle and that is the validation.
I have extended the kendo validation to include remote validation to check if a field name exists in the database already, that all works fine but the problem currently is that if I include the jQuery validation and jQuery unobtrusive validation into my scripts I would get 404 errors every time I type something into the text box (because the remote url passed down is different on unobtrusive than on kendo validation). I have attached an image of the 404 error I am getting.
But if I remove jQuery validation and jQuery unobtrusive I get no errors but because of the nature of razor pages the kendo remote validation does not register to the model and so even if the remote validation failed, the field is updated/added.
app.js
"use strict"
;
import gridFunctions from
"./js/gridFunctions"
;
// Top level packages that need to be initiated first
import $ from
"../node_modules/jquery/dist/jquery"
;
window.jQuery = $;
window.$ = $;
gridFunctions();
// Scss
import
"./scss/app.scss"
;
// Add all kendo
import
"@progress/kendo-ui"
;
import
"@progress/kendo-ui/js/kendo.aspnetmvc"
;
import
"@popperjs/core"
;
// Add jquery validation
import
"jquery-validation/dist/jquery.validate"
;
import
"jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive"
;
// Add boostrap js
import
"@popperjs/core/dist/cjs/popper"
;
import
"bootstrap/dist/js/bootstrap.bundle"
;
// Add Font Awesome
import
"@fortawesome/fontawesome-free/js/all"
;
$.validator.setDefaults({
ignore:
""
});
Edit.cshtml
<
form
method
=
"post"
>
<
input
type
=
"hidden"
asp-for
=
"@Model.SystemRole.SystemRoleId"
/>
@* Inputs *@
<
div
class
=
"row"
>
<
div
class
=
"col-sm-3"
>
<
div
class
=
"input-outer"
>
<
label
asp-for
=
"@Model.SystemRole.SystemRoleDesc"
class
=
"required"
></
label
>
<
input
asp-for
=
"@Model.SystemRole.SystemRoleDesc"
data-val-remote-additionalfields
=
"SystemRoleDesc"
data-val-remote-url
=
"CheckSystemRoleDescExists"
class
=
"k-textbox"
/>
<
span
asp-validation-for
=
"@Model.SystemRole.SystemRoleDesc"
></
span
>
</
div
>
<
div
class
=
"input-outer"
>
<
label
asp-for
=
"@Model.SystemRole.SystemRoleRef"
class
=
"required"
></
label
>
<
input
asp-for
=
"@Model.SystemRole.SystemRoleRef"
data-val-remote-additionalfields
=
"SystemRoleRef"
data-val-remote-url
=
"CheckSystemRoleRefExists"
class
=
"k-textbox"
/>
<
span
asp-validation-for
=
"@Model.SystemRole.SystemRoleRef"
></
span
>
</
div
>
<
div
class
=
"input-outer"
>
<
label
asp-for
=
"@Model.SystemRole.IsDeleted"
></
label
>
<
input
asp-for
=
"@Model.SystemRole.IsDeleted"
type
=
"checkbox"
data-validate
=
"false"
class
=
"k-checkbox"
>
<
span
asp-validation-for
=
"@Model.SystemRole.IsDeleted"
></
span
>
</
div
>
</
div
>
<
div
class
=
"col-sm-3"
></
div
>
<
div
class
=
"col-sm-3"
></
div
>
<
div
class
=
"col-sm-3"
></
div
>
</
div
>
<
hr
/>
@* Buttons *@
<
input
type
=
"submit"
value
=
"Update"
class
=
"btn btn-primary"
/>
</
form
>
Any help is really appreciated!
Thank you.