JQgrid shows custom message in form field

Using the latest free jqgrid version.

In one of the form fields, I have an onchange event associated with a text field. In the event, I make an ajax call for my mvc controller, which checks the input entered. The only problem I encountered is to show any custom message if the input was invalid. I have the code below:

 {
   name: 'id', index: 'id', width: 60, sorttype: "text", editable: true, align: "right", editrules: { required: true },
   editoptions:
    {
     dataEvents: [
         {
          type: 'change',
          fn: function (e) {                              
              var input= $(this).val();
                 $.ajax({
                     url: '@Url.Action("Verify", "Home")',
                     data: "id=" + input,
                     type: "GET",
                     success: function (data){
                       if(data == '')
                       {
                         //Show custom message
                       }
                     },
                     error: function (passParams) {
                     }
                    });
                   }
                  }
                 ]}
                }

I know that I can display a message after a submit event, as shown below, but I want to have a custom message in the onchange text field in the form field.

afterSubmit: function (response, postData) {
     return [false, 'Custom Message'];
     }
0
source share

All Articles