Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-61855

Required property of multi-select field is not validated for web content

    Details

      Description

      Steps to reproduce

      1. Create a web content structure with a select field, the field should be required and multiple choice should be enabled as well
      2. Add a template for this structure
      3. Create a web content with this structure, add a title and do NOT select any of the options in the select field
      4. Publish

      Expected behaviour

      As the select field is required, a validation error should occur because the field is left untouched.

      Actual behaviour

      No validation error appears.

      additional info

      On master creating a web content structure is impossible, so it can not be reproduce.
      However it can be easily reproduce on 6.2.x and it the code clearly shows that the bug exists

      root cause

      The root cause is in DDMXMLImpl.java, getFields method.

      			List<Element> dynamicContentElements =
      				dynamicElementElement.elements("dynamic-content");
      
      			for (Element dynamicContentElement : dynamicContentElements) {
      

      Here the dynamicContentElements is empty because the user did not choose any option from the multi-select field.
      Unfortunately in this case the getFields method will not return with the select field so later the code will not check if it is required or not.

        Attachments

        1. Fixed.gif
          Fixed.gif
          258 kB
        2. Fixed62.gif
          Fixed62.gif
          300 kB
        3. Reproduced.gif
          Reproduced.gif
          774 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 30 weeks, 2 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.0 Beta 3