nova-issues
nova-issues copied to clipboard
Repeater field doesn't work with certain validation rules
- Laravel Version: ^11.0
- Nova Version: ^4.33
- PHP Version: 8.3.2
- Database Driver & Version: SQLite
- Operating System and Version: Windows 11
- Browser type and version: Edge
- Reproduction Repository: https://github.com/ecreeth/nova-issue
Description:
I've been facing some inconsistencies with the following validation rules:
Detailed steps to reproduce the issue on a fresh Nova installation:
- Create a Repeatable field
class LineItem extends Repeatable
{
public function fields(NovaRequest $request)
{
return [
ID::hidden(),
Currency::make('Price')
->min(1)
->step(0.01)
->fullWidth()
->rules('required', 'numeric', 'gt:cost'),
Currency::make('Cost')
->min(1)
->step(0.01)
->fullWidth()
->rules('required', 'numeric', 'lt:price'),
];
}
}
- Call the repeatable
Repeater::make('Presentations')
->required()
->sortable(false)
->uniqueField('id')
->asHasMany(Presentation::class)
->repeatables([
LineItem::make()->confirmRemoval(),
]),
- Add 500 to the
price
and 250 to thecost
like:
Please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)
Hi @crynobone!, Here's the repo link with the bug https://github.com/ecreeth/nova-issue. You can see it too in the video below.
https://github.com/laravel/nova-issues/assets/20761166/71de8a5e-7739-4168-b45c-8cdac00e8251
@ecreeth Thanks for the reproducing setup, I managed to reproduce the issue and narrow down the cause as well.
To manage expectations, we have short term plans to focus on them and get them out of beta, so we will fix this issue at that time 👍
Released with Laravel Nova 5.0.0
Feel free to open up a new issue if you're still experiencing this problem on the latest version.