We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Position of validation messages in InlineTemplateForm mode

Hi

Is it possible to change the position of validation error message?

Currently the message appear below the control overlapping the control below, so I would prefer the error message on the right side of the control.

As it's based on the jquery validation I tried to change the errorElement but without success so far.

Any example how to do this?

Regards,
Reinhard

1 Reply

MS Madhu Sudhanan P Syncfusion Team December 5, 2014 10:56 AM UTC

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


Loader.
Live Chat Icon For mobile
Up arrow icon