mrmonat / nova-translatable

Nova Field for spatie/laravel-translatable package.
81 stars 26 forks source link

'required' validation rule only enforced on one locale #40

Open nathan-io opened 4 years ago

nathan-io commented 4 years ago

Say we have a field like:

Translatable::make( __('Slug'),  'slug')->rules('required')->sortable()->help(__('help.tips.slug')),

In our application, we have two locales.

If I try to submit the form without entering a value for either locale, I get a validation error stating that the field is required.

However, if I enter a value for only one of the two locales, the submission goes through.

How can we require that all a value is present for all locales?

approached commented 3 years ago

Same problem, do you have a solution now?

I think there are just miss some required parameter in file: https://github.com/mrmonat/nova-translatable/blob/master/resources/js/components/FormField.vue

austyuzhaninov commented 3 years ago

Any solutions? This is still a problem

hernaval commented 2 years ago

I have encountered this issue also. To resolve, I have added custom validation rules where I can verify if fr and en (and so on...) are not empty or else fail the validation. My code is bellow, can be improve validation

Let's analyze it a bit:

As you see, you can add more locales validation but for me i just use 'fr' and 'en'

Hope It helps