Uploaded image for project: 'Ibexa IBX'
  1. Ibexa IBX
  2. IBX-6832

`FormSubmissionService` uses invalid field when multiple fields of the same type are present

    XMLWordPrintable

Details

    • Ibexa Experience
    • Yes

    Description

      If converter depends on parameters provided for form field configuration it will always take parameters from the first field of the same type, which is wrong.

      Steps to reproduce:

      1. Create a custom Form field like shown in the documentation https://doc.ibexa.co/en/3.3/guide/form_builder/create_custom_form_field/.
        with minor change:
        ez_platform_form_builder:
            fields:
                country:
                    name: Country
                    category: Custom form fields
                    thumbnail: '/bundles/ibexaplatformicons/img/all-icons.svg#places'
                    attributes:
                        parameter:
                            type: integer
                            name: Parameter
                        label:
                            name: Display label
                            type: string
                            validators:
                                not_blank:
                                    message: You must provide a label for the field
                        help:
                            name: Help text
                            type: string
                    validators:
                        required: ~
        

        (adding parameter attribute).

      2. Create a Form with two newly created fields and set parameter values to 1 and 2 respectively and one submit button.
      3. In vendor/ezsystems/ezplatform-form-builder/src/lib/FormSubmission/FormSubmissionService.php file on line 78 add the following:
        $parameter = $field->getAttribute('parameter');
        dump($parameter);
        
      4. Submit the form and observe the dump results.

      Result:
      The parameter values is always 1.

      Expected result:
      The parameter values should be 1 and 2 respectively.

      Designs

        Attachments

          Activity

            People

              Unassigned Unassigned
              bartlomiej.wajda@ibexa.co Bartłomiej Wajda
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: