Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Value not passed to custom validator if nested validation #349

@waterbrookbespoke

Description

@waterbrookbespoke

Custom validator:

_customValidator() {
       validate.validators.custom = function (value, options, key, attributes) {
           console.log(sprintf("Custom validation %s value: %s", key, value));
           console.log("Custom validation %s options: %s",key, options);
           console.log("Custom validation %s attributes: %s", key, JSON.stringify(attributes));

           return "is totally wrong";
       };
   },

Console Log:
// Value passed correctly for single level validation
Custom validation lastname value: Flintstone
Custom validation lastname options: true
Custom validation lastname attributes: {"firstname":"","lastname":"Flintstone","":{},"names":[{"firstname":"Barney","lastname":"Rubble"},{"firstname":"Wilma","lastname":"Flintstone"}]}

// Value undefined for nested validation
Custom validation names.lastname value: undefined
Custom validation names.lastname options: true
Custom validation lastname attributes: {"firstname":"","lastname":"Flintstone","":{},"names":[{"firstname":"Barney","lastname":"Rubble"},{"firstname":"Wilma","lastname":"Flintstone"}]}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions