Support the ongoing development of Laravel.io →
Laravel Validation

I have a disclosure form that I only need to validate 2 fields out of six based on if the required question asked (radio button) is YES.

So if yes then,

A> company1 and details1 are required if any one of these 2 fields have text and the other four fields are not required (company2, details2, comapny3, details3) OR;

B> company2 and details2 are required if any one of these 2 fields have text and the other four fields are not required (company1, details1, comapny3, details3) OR;

C> company3 and details3 are required if any one of these 2 fields have text and the other four fields are not required (company1, details1, comapny2, details2)

Thanks

Last updated 3 years ago.
0

Check out required_if validator rule and required_with, required_without

https://laravel.com/docs/6.x/validation#available-validation-rules

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Keith Daigle kadcore Joined 26 Mar 2020

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.