getUpdateHandler(req).process({fileds: validator})
is quite different than the error message from req.flash('error', msg)
and gives the views a different object to render. using conditional statement could solve it , any solution from your guys? or Did I do it in the wrong way?
// Error from getUpdatehandler
{ info: [],
success: [],
warning: [],
error:
[ { type: 'ValidationError',
title: 'There was a problem saving your changes',
list: [Array] },
'Password must be longer than 8 characters.' ] }
// Error from req.flash
{ info: [],
success: [],
warning: [],
error: ['Password must be longer than 8 characters.' ] }
Lists > Options > label
api and next
should nothing to do with Mongoose, it is express middleware function. hope it could help you.
// Load the current post
view.on('init', function (next) {
var q = keystone.list('Post').model.findOne({
state: 'published',
slug: locals.filters.post,
});
q.exec(function (err, result) {
locals.data.post= result;
console.log(result);
title: locals.data.post.title;
next(err);
});
});
view.render('post');
view.on('init', function (next) {
var q = keystone.list('Post').model.findOne({
state: 'published',
slug: locals.filters.post,
});
q.exec(function (err, result) {
locals.data.post= result;
/* Try this */
locals.title: locals.data.post.title
console.log("Locals: ", locals)
console.log("Locals > Title: ", locals.title)
next(err);
});
});
view.on('init')
over view.on('get')
in indirect way. 🤔