JQgrid show custom message on form field

半世苍凉 提交于 2019-12-24 21:45:48

问题


Using free jqgrid latest version.

In one of the form fields I have onchange event tied up to the textbox. On the event I make an ajax call to my mvc controller which validates the input that was entered. The only issue I am having is how to show any custom message in case the input was invalid. I have the below code :

 {
   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 I can display the message on the after submit event as below but I want to have custom message on the onchange of the textbox in the form field.

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

来源:https://stackoverflow.com/questions/48524588/jqgrid-show-custom-message-on-form-field

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!