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

Cannot disable selectNullable in Liferay.DynamicSelect

    Details

      Description

      Steps to reproduce:

      Modify modules/apps/foundation/users-admin/users-admin-web/src/main/resources/META-INF/resources/organization/details.jsp so each of the elements in Liferay.DynamicSelect has the selectNullable attribute set to false:

      	new Liferay.DynamicSelect(
      		[
      			{
      				select: '<portlet:namespace />countryId',
      				selectData: Liferay.Address.getCountries,
      				selectDesc: 'nameCurrentValue',
      				selectId: 'countryId',
      				selectNullable: false,
      				selectSort: '<%= true %>',
      				selectVal: '<%= countryId %>'
      			},
      			{
      				select: '<portlet:namespace />regionId',
      				selectData: Liferay.Address.getRegions,
      				selectDesc: 'name',
      				selectId: 'regionId',
      				selectNullable: false,
      				selectVal: '<%= regionId %>'
      			}
      		]
      	);

      After deploying the module, the expected behavior is that when you create an Organization, there isn't any blank option for Country. Actual behavior is that there is always a blank option for Country.

      Root cause analysis:

      In dynamic_select.js, we see the following:

      var selectNullable = options.selectNullable || true;

      This cannot ever evaluate to false. This results in a situation where Liferay.DynamicSelect always forces a null entry in the drop-down select menu.

        Attachments

        1. blank-option-on62.png
          blank-option-on62.png
          158 kB
        2. fixed-lps65926.png
          fixed-lps65926.png
          72 kB
        3. fixed-on62-lps65926.png
          fixed-on62-lps65926.png
          119 kB
        4. reproduced-lps65926.png
          reproduced-lps65926.png
          48 kB

          Issue Links

            Activity

              People

              Assignee:
              felix.zhang Felix Zhang
              Reporter:
              minhchau.dang Minhchau Dang
              Participants of an Issue:
              Recent user:
              Esther Sanz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 29 weeks, 6 days ago

                  Packages

                  Version Package
                  6.2.X EE
                  7.0.1 CE GA2