Hi Reinhard,
Thanks for using Syncfusion products.
Please find the response.
Query: “Is it
possible to change the position of validation error message?”
We can place the error message by overriding the errorPlacement of the jquery validate
as follows. In the below code snippet, we have changed the errorPlacement of
the message element in the actionComplete
event. Please refer the code snippet.
@(Html.EJ().Grid<object>("ExportGrid")
. . . . .
.ClientSideEvents(evt=>evt.ActionComplete("setErrorElement"))
)
function
setErrorElement(args) {
if (args.requestType == "add" ||
args.requestType == "beginedit") {
var validate = $("#" + this._id + "EditForm").validate();
validate.settings["errorPlacement"] = function (error, element) {
var $td =
element.closest("td"), $container = $(error).addClass("e-error");
$td.find(".e-error").remove();
element.hasClass("e-numerictextbox") ? $container.insertAfter(element.closest(".e-numeric"))
: $container.insertAfter(element);
$container.offset({ left:
element.offset().left + element.outerWidth(), top: element.offset().top });
}
}
}
|
For your convenience, we have created simple grid sample too
and the same can be downloaded from the below location.
Sample Location: http://www.syncfusion.com/downloads/support/directtrac/general/Forum_errorMsg1024552941.zip
Please let us know if you have any queries.
Regards,
Madhu Sudhanan. P