DatePickers validation in differents Wizard's steps

Hello, I'm stuck on validating a date. Let me explain: I have a Wizard that has two Steps (Expeditions and Samples) A shipment can have one or more samples. - the Expedition step I have a 'date_depart' field - The Samples step, which is a repeater, I have a 'date_sampling' field which must be less than or equal to 'date_depart' In my Samples step, I have this:
DatePicker::make('date_prelevement')
->required()
->rules(['date'])
->beforeOrEqual('date_depart')
->label('Date de prélevement')
->placeholder('Choisir la date de prélevement')
->columnSpan([
'default' => 12,
'md' => 12,
'lg' => 12,
]),
DatePicker::make('date_prelevement')
->required()
->rules(['date'])
->beforeOrEqual('date_depart')
->label('Date de prélevement')
->placeholder('Choisir la date de prélevement')
->columnSpan([
'default' => 12,
'md' => 12,
'lg' => 12,
]),
With this code, I have the impression that the 'date_depart' field is unknown to it. Can you enlighten me please
2 Replies
Dan Harrin
Dan Harrin2y ago
its not to do with the wizard, its to do with the repeater try this ->beforeOrEqual(fn (callable $get): string => (string) $get('../../date_depart'))
Moudjames23
Moudjames23OP2y ago
Thank you. @Dan Harrin, It's Work
Want results from more Discord servers?
Add your server