Skip to content

Form validation improvements. Added support captions for "$each"

Ruslan Onyshchenko requested to merge feature/form_validation_improv into master

Suppose we need to do a validation like this:

image

And we want to use construction like this:

image

In this case we should set captions for all 100500 properties like this:

...
'crimeCases.$each.125.data.discardReason:caption' () {
  return this.$ut('app_crimeCase.discardReason')
},
'crimeCases.$each.126.data.discardReason:caption' () {
  return this.$ut('app_crimeCase.discardReason')
}
...

Otherwise, after validation, we will get an error like this:

image

After improvement, we can write like this:

'crimeCases.data.offence:caption' () {
  return this.$ut('app_crimeCase.offence')
},
'crimeCases.data.discardReason:caption' () {
  return this.$ut('app_crimeCase.discardReason')
}

and get correct error like this:

image

Edited by Ruslan Onyshchenko

Merge request reports

Loading