joi-errors-for-forms
joi-errors-for-forms copied to clipboard
periods replace with commas in input names/ids
For example, if a text input has the name 'address.city', and it has an error, the error object returned by require('joi-errors-for-forms').form is
{address,city: "required"} instead of {address.city: "required"}
it appears to start occurring since [email protected] and is related to how path is constructed (https://github.com/hapijs/joi/issues/1302). Changing from:
var path = detail.path;
to:
var path = detail.path.join('.');
fixes the problem.