问题
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