Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Nested repeater problems #64

Open
raneri opened this issue Feb 16, 2023 · 0 comments
Open

Nested repeater problems #64

raneri opened this issue Feb 16, 2023 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@raneri
Copy link

raneri commented Feb 16, 2023

Expected Behavior

I'm using a "questions > answers" nested repeater: the question layout contains a second repeater for its questions:
I'm expecting that dragged questions will bring also the answers inside.

Actual Behavior

When I drag a question, it is correctly moved to the new position, but the answers are visually duplicated (if I have answer a, b, c I will get a, b, c, a, b, c -- but when I save they aren't stored duplicated in the database). In addition of this, the index of the "group" of fields of the answers isn't updated, so when I save they are saved to another question. << this is the major problem because it screws up the data

Steps to Reproduce the Problem

This is the layout of the question repeater, that is creating a nested repeater for the answers:

class QuestionRepeater extends Rows
{
    function fields(): array
    {
        return [
            Input::make('id')->hidden(true),
            Input::make('question')
                ->type('text')
                ->size(255)
                ->maxlength(255)
                ->required()
                ->title('Question text'),
            Repeater::make('answers')
                ->title('Answers')
                ->layout(AnswerRepeater::class),
        ];
    }
}

Specifications

  • ORCHID Platform Version: 13.10.0
  • Laravel Version: 9
  • PHP Version: 8.0.3
  • Database Version: 10.4.18-MariaDB
@Nks Nks added help wanted Extra attention is needed bug Something isn't working labels Sep 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants