Uploaded image for project: 'Magnolia Form Module'
  1. Magnolia Form Module
  2. MGNLFORM-359

Mandatory property not working on formFile

    XMLWordPrintable

Details

    Description

      Steps to reproduce

      1. Configure the formFile component to have a mandatory boolean property. Like formEdit.
      2. Add the formFile component to any formulary with the new property set to true
      3. Trying to submit the form, either with a file attached or not, will result on an error taking place.

      Expected results

      The form can't be submitted only if the file is not attached.

      Actual results

      The form can't be submitted wether the file is attached or not.

      Workaround

      Development notes

      The check seems to take place here:

      https://git.magnolia-cms.com/projects/MODULES/repos/form/browse/magnolia-form/src/main/java/info/magnolia/module/form/templates/components/DefaultFormDataBinder.java#152

      The validation doesn't take into account that StringUtils.isEmpty will return null if the field is an attachment, resulting on it always returning an error.

      Checklists

        Acceptance criteria

        Attachments

          1. formFile_requiredField.gif
            969 kB
            Yen Lac Tue
          2. null_value_mandatoryField.png
            39 kB
            Yen Lac Tue

          Activity

            People

              yen.lactue Yen Lac Tue
              rgaona Roberto Gaona
              AuthorX
              Votes:
              3 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD

                  Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0d
                    0d
                    Logged:
                    Time Spent - 4.25d
                    4.25d