Hi,
All code below runs on NodeJS/Express/EJS.
I have a two file form.js and grid.js.
In the form.js I create grid object and define custom validator like here:
-------------------------------------------------------------------------------------------------
...
rest.get(uri, {}).on('complete', function (data, result) {
var schemeGridColumns = {};
...
schemeGridColumns["field1"].validation = {
required: true,
custom: function (input) {
if (input.is("[name=field1]") && input.val().length > 5) {
input.attr("data-custom-msg", "My notification from validator.");
return false;
}
return true;
}
...
var grid = {
editable: {
mode: "popup",
....
},
transport: {
.....
},
...
dataSource: {
....
schema: {
data: 'data',
total: 'total',
model: {
id: gridKeys,
fields: gridSchemaFields
}
}
},
....
};
res.render("grid.js", grid: grid, ....);
)};
--------------------------------------------------------------------------
File grid.js looks like this:
----------------------------------------------------------------------------
<div id="grid" style1="float:left"></div>
<div class="clear1"></div>
<script language="javascript">
$(document).ready(function() {
titan.setTitle('<%= title %>');
// create Kendo UI Grid
$('#grid').kendoGrid(<%- JSON.stringify(grid) %>);
});
</script>
--------------------------------------------------------------------------------
The problem is that standard validation require works in popup,
but custom doesn't fire. I've tried with inline mode. Result is the same.
May be problem with EJS template compiler?
All code below runs on NodeJS/Express/EJS.
I have a two file form.js and grid.js.
In the form.js I create grid object and define custom validator like here:
-------------------------------------------------------------------------------------------------
...
rest.get(uri, {}).on('complete', function (data, result) {
var schemeGridColumns = {};
...
schemeGridColumns["field1"].validation = {
required: true,
custom: function (input) {
if (input.is("[name=field1]") && input.val().length > 5) {
input.attr("data-custom-msg", "My notification from validator.");
return false;
}
return true;
}
...
var grid = {
editable: {
mode: "popup",
....
},
transport: {
.....
},
...
dataSource: {
....
schema: {
data: 'data',
total: 'total',
model: {
id: gridKeys,
fields: gridSchemaFields
}
}
},
....
};
res.render("grid.js", grid: grid, ....);
)};
--------------------------------------------------------------------------
File grid.js looks like this:
----------------------------------------------------------------------------
<div id="grid" style1="float:left"></div>
<div class="clear1"></div>
<script language="javascript">
$(document).ready(function() {
titan.setTitle('<%= title %>');
// create Kendo UI Grid
$('#grid').kendoGrid(<%- JSON.stringify(grid) %>);
});
</script>
--------------------------------------------------------------------------------
The problem is that standard validation require works in popup,
but custom doesn't fire. I've tried with inline mode. Result is the same.
May be problem with EJS template compiler?