Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    getErrors map: using title iso name?

    Hi,

    would it be fairly simple to get the title instead of the name of the field on which a validation error occurred as key in the map of getErrors?
    Or maybe even a better: allow a (custom) object as key & value in that map, as technically, titles don't have to be unique.

    We're showing all validation errors together somewhere, and for a user, it does not make sense to show a field name as he only sees field titles on the UI. Omitting the key is not a good idea, since that would show the same error messages a few times without knowing about which field the error is about.


    We're calling the valuesManager.getErrors, which manages a more complex structure instead of just 1 datasource. So a simple substitution of name into title at that level would be too late.
    The valuesManager manages a lot of forms. Doing an individual form[n].getErrors and substituting the keys there with their title does work, but brings a lot of places to code, and does not allow to get all errors at once. So a working solution exists, but it's not ideal, hence the question for a better way?


    Or, is there maybe a way to change the validator.errorMessage so it differs at the tooltip above the error icon next to the formitem, and the errorMessage showing up in the getErrors map? That way, we could change the message and substituting it with the form item's title.
    I thought of doing this with Velocity (the clientOnly validator is defined in the DataSource). Is that possible? (since it's clientOnly, I guess velocity will never kick in, right?).


    cheers,

    #2
    Sorry, not really understanding the question. The validation errors are made available with fieldNames, and DataSource.getField().getTitle() or DynamicForm.getItem().getTitle() gets you the title if you need it.

    Comment


      #3
      No problem, I'll do it myself manually.

      Comment

      Working...
      X