danielantelo / AddressableBundle

Symfony2 bundle which facilitates making entities addressable and geo location aware. It includes a map form type to set address by searching in a google map.
6 stars 11 forks source link

Bug with validation? #17

Open migmolrod opened 5 years ago

migmolrod commented 5 years ago

Don't know if it can be called a 'bug'. Maybe 'room for improvement'. The thing is as follows:

Steps to reproduce:

  1. Follow the Installation steps.
  2. Make latitude and longitude visible as text types.
  3. Go to the backend in your browser and put an incorrect value like 'aaaa' in either latitude or longitude (or both).

What happens:

The validation errors for those fields are shown at the start of the form.

What should happen:

Each of those validation errors should be shown next to the corresponding field.

How to solve:

I think using the error_mapping option from Symfony Forms documentation should work (unless I misunderstood that option, which would not be rare XD) but I'm not able to get it right. Don't know where to use the error_mapping option. The AddressMapType? The AddressableAware model? The fields? What to put in the left and right sides of that option?

migmolrod commented 5 years ago

Anything on this, @danielantelo ?

I've tried several combinations of error_mapping, error_bubbling and property_path to no avail :(

danielantelo commented 5 years ago

Let me have a look at this, has been a while since i’ve updated this bundle, what version of symfony are you using? Are you using it standalone or via sonata admin?

migmolrod commented 5 years ago

It's actually a Sylius project with Symfony 4.3. Sylius directly uses the Symfony Forms to generate CRUDs unlike SonataAdmin which uses their own AbstractAdmin that you need to extend. So I'd say it's a standalone implementation.