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

Blank option is wrongfully present in options of a required web content select field

    Details

    • Type: Regression Bug
    • Status: Verified
    • Resolution: Unresolved
    • Affects Version/s: 7.3.10 DXP GA1
    • Fix Version/s: None
    • Component/s: Dynamic Data Mapping
    • Labels:
      None
    • Fix Priority:
      3

      Description

      After reading 

      1. LPS-72849

      It looks like a required field in web content should not be allowed to be submitted blank. However since 7.1 there has been an additional (and unhelpful) possibility of submitting a null value when adding web content using the select drop down fields.

      The HTML now present in the dropdowns allows for a null value to be selected on a required field:

      <option class="" selected="" value=""></option>

       

      The basic premise of a required field would be that a choice must be made. However, this blank option is allowing users to make nothing as a choice which is frustrating to template developers because this has been forced upon them by Liferay. Having a user choose nothing in a required field frustrates a developer trying to test against that value.

      There shouldn't be a blank entry being inserted by Liferay even in non-required fields simply because null values do break Freemarker rendering if not handled by the template developer. In particular as is the case in my case where 7.0 did not have this blank option and now DXP does all the templates created under 7.0 wouldn't have considered this null value. Template developers are capable of giving their users a "skip option" option in their structures, they don't need null values like this.

       

      Expected:
      No blank or null option in a required field, this blank option should be omitted. From a UX perspective the user shouldn't be given a blank list item because it's meaningless. There should be wording such as "None", "Default", "Not Applicable". Which would look like:

      <option value="usernull">Not Applicable</option>

      Actual:
      Blank Option is present as the first option, if selected on a required field the form can't be submitted to this blank option should be omitted.

       

      I've attached the template and structure being used to test in 7.3.10 GA1.

       

      There is a workaround also in the admin theme jQuery in portal_normal.ftl can target and remove these blank options:

      $(document).on('click', '#content .portlet-journal-content .lfr-ddm-field-group select.form-control', function() {
         if($(this).find('option').get(0).value.length == 0) {
          $(this).find('option').get(0).remove();
         }
      });
      

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            lee.jordan1 Lee Jordan
            Participants of an Issue:
            Recent user:
            Nilo Rodrigues
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Days since last comment:
              47 weeks, 4 days ago

                Packages

                Version Package