Announcement Announcement Module
Collapse
No announcement yet.
Validation errors in sub objcects of command object Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Validation errors in sub objcects of command object

    Hi,

    there is an example. Let's say i have command object 'Command':

    Code:
    public Class Command{
            int size;
            Employee employee;
    }
    after binding and validation i want to know in the controller if there were any errors associated with any of fields in employee object.

    i thougt i could check it like this:

    errors.pushNestedPath("employee");
    boolean hasErrors = errors.hasFieldErrors();
    // or errors.hasFieldErrors("employee.*");
    but that doesn't work. It mean it still reports errors if command.size has error and emploee's fields are valid.

    My question is if there is a convinient way to check if there are any errors in sub object (employee) of command object
    Last edited by jonasnas; Feb 6th, 2010, 05:57 AM.

  • #2
    For now, it seems that iterating over getFieldErrors() and checking for getField().startsWith("employee.") is the only option.
    Besides, making getFieldErrors(String) work with wildcards might be a good enhancement request.

    Comment


    • #3
      Thanks for your reply

      Comment

      Working...
      X