ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: unixgeri on July 05, 2014, 07:32:13 am
-
how can i define a custom validation function, whith custom parameters
and custom msg.
for example
function taxnumberIsValid(value,country) {
......
}
...
{ title: "country"},
{ title: "tax number",
validations: ????????
}
Thanks in advance!
-
Pass ui parameter to the callback function which may be anonymous or a named function.
function taxnumberIsValid( ui ){
var country = ui.rowData["country"],
value = ui.value; //value is taxno as entered in the editor
//do the validation and if it fails assign message to ui.msg and return false
if( validation fails ){
ui.msg = "some message";
return false;
}
}
{ title: "Country", dataIndx: "country" },
{ title: "tax number", dataIndx: "taxno",
validations: [ { type: taxnumberIsValid }]
}
Reference: http://paramquery.com/pro/api#option-column-validations
Example: http://paramquery.com/pro/demos/editing_custom Books column