Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeater field doesn't work with certain validation rules #6395

Open
ecreeth opened this issue May 17, 2024 · 2 comments
Open

Repeater field doesn't work with certain validation rules #6395

ecreeth opened this issue May 17, 2024 · 2 comments
Labels
beta-feature pending Issues that are pending triage

Comments

@ecreeth
Copy link

ecreeth commented May 17, 2024

  • 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:

  1. gt:rule
  2. lt:rule

Detailed steps to reproduce the issue on a fresh Nova installation:

  1. 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'),
        ];
    }
}
  1. Call the repeatable
Repeater::make('Presentations')
  ->required()
  ->sortable(false)
  ->uniqueField('id')
  ->asHasMany(Presentation::class)
  ->repeatables([
      LineItem::make()->confirmRemoval(),
]),
  1. Add 500 to the price and 250 to the cost like:
    image
@crynobone
Copy link
Member

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)

@crynobone crynobone added the needs more info More information is required label May 20, 2024
@ecreeth
Copy link
Author

ecreeth commented May 21, 2024

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.

Screen.Recording.2024-05-20.at.8.08.01.PM.mov

@crynobone crynobone added beta-feature pending Issues that are pending triage and removed needs more info More information is required labels May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-feature pending Issues that are pending triage
Projects
None yet
Development

No branches or pull requests

2 participants