0

For checking server side validation errors, I am using "afterSubmit" property of jqGRid.

afterSubmit: checkForErrors

And my checkForErrors is something like this:

function checkForErrors(response,postdata){
    var success = true;
    var message = ""
    var json = eval('(' + response.responseText + ')');
    if(json.errors.length>0) {
        success = false;
        for(i=0; i < json.errors.length; i++) {
            message += json.errors[i] + '<br/>';
        }
    }
    var new_id = null;
    return [success,message,new_id];
}

The only thing i need to fix is change the default error class/style used by jqgrid (ie. ui-state-error), to my custom css class. How can i do that.

Thanks!

user620339
  • 851
  • 3
  • 20
  • 42
  • Look at the demo from [the answer](http://stackoverflow.com/questions/6791463/jquery-jqgrid-show-message-when-an-edit-row-is-complete/6803206#6803206). Is that what you need? – Oleg Aug 08 '11 at 17:32

1 Answers1

0

Try this:

function checkForErrors(response,postdata){
    var success = true;
    var message = ""
    var json = eval('(' + response.responseText + ')');
    if(json.errors.length>0) {
        success = false;
        for(i=0; i < json.errors.length; i++) {
            message += json.errors[i] + '<br/>';
        }
    }
    var new_id = null;

    //Here pass the right class name instead of ".dialog" which you are using in your code
   $(".dialog").find(".ui-state-error").removeClass("ui-state-error").addClass("newClass");

    return [success,message,new_id];
}
ShankarSangoli
  • 69,612
  • 13
  • 93
  • 124