Skip to content Skip to sidebar Skip to footer

Jqgrid Need 'enter' Key To Perform Validation Functions With Inline Editing

I have a jqGrid (pared-down example below) where I need rather complicated validation to be done as new rows are being selected, unselected, and (later) when the grid is saved. The

Solution 1:

First of all I would recommend you to use

editoptions: {maxlength: 5}

to restrict the max length of the input characters. For the validation you can use additionally editrules. If the example only the demo and you need some really complex validation you consider to use custom validation rule. For example

editrules: {custom:true, custom_func:myValidate1}

where

function myValidate1 (value, colname) {
    if (value.length > 5) {
        return [false, " is too long for the column '" +
                       colname + "'\nMax 5 char is permitted"];
    } else {
        return [true, ""];
    }
}

see the demo.

Post a Comment for "Jqgrid Need 'enter' Key To Perform Validation Functions With Inline Editing"