Repeater requiredIf validation from the field outside of repeater

Hello,

I am trying to make requiredUnless if the TextInput (outside of Repeater) has a certain value but it doesn't work, Please let me know how can I make this validation work?

Repeater::make("passenger_details")
->grid(2)
->schema([
TextInput::make("first_name")
->requiredUnless('passenger_type', 'self'),

TextInput::make("last_name")
->requiredUnless('passenger_type', 'self'),

TextInput::make("email")
->email(),

TextInput::make("phone")
->tel(),

])


Also I tried $get('passenger_type') inside the repeater and the passenger_type input is outside of the repeater.

Thank you
Solution
->requiredUnless(statePath: 'data.passenger_type', stateValues: 'self', isStatePathAbsolute: true)
Was this page helpful?