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

Select field cannot be empty in Custom Document Type

    Details

      Description

      We can not create a select field with empty option or empty value.

      steps to reproduce

      1. Start portal
      2. Navigate Control Panel > Documents and Media
      3. Click on Manage > Document Types
      4. Drag and drop a Select field to the Main Metadata Fields
      5. Configure this field
      6. It has 3 options, clear the first option's value or clear the first option's text
      7. click on save

      expected behaviour

      A select box with the first option's text empty or the first option's value empty

      experienced behaviour

      The option will be deleted

      root cause

      Alloy UI, aui-datatable-edit.js - saveOptions:

                 names.each(function(inputName, index) {
                          var name = inputName.val();
                          var value = values.item(index).val();
      
                          if (name && value) {
                              options[value] = name;
                          }
                      });
      

      See the if (name && value). So the value is stored in options[] only when value is not empty. It should be changed to name || value

        Attachments

        1. 45417_6.1_fix.gif
          45417_6.1_fix.gif
          400 kB
        2. Failed Result.gif
          Failed Result.gif
          1.68 MB
        3. Reproduced Result.png
          Reproduced Result.png
          101 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 38 weeks, 2 days ago

                  Packages

                  Version Package
                  6.1.X EE
                  6.2.2 CE GA3
                  6.2.X EE