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

Remove Blank Options From Web Content Structure Select Fields

    Details

      Description

      A disimprovement was made in 7.1 that brought null values to Web Content Templates and Structures that were created in 7.0. This can crash web content templates when a user tries to select these blank options and the template logic isn't setup to handle null values.

      The issue may not have been problematic in Velocity but it can be catastrophic for Freemarker when developers haven't used an attempt and recover block.

       

      Steps:
      1) Create a web content template and structure that includes a select with three options
      2) Try adding content to that structure and notice there is a blank entry at the top

      Expected:
      No Blank Entry

      Actual:
      Blank Entry

       

      Workaround for those template developers reading ... In an admin theme do this to avoid having to write an override.

       

      // WHEN IN DOUBT NUKE IT
      <style>
      body .hide {
       display : none !important;
      }
      </style>
      
      <script>
      jquery document load here ...
      $(document).on('mouseenter', '#content .portlet-journal-content .lfr-ddm-field-group select.form-control', function() {
       if (!$(this).find("option[value='']").hasClass("hide")) {
          $(this).find("option[value='']").addClass("hide").wrap("<span class='hide'></span>");
       }
      });
      </script>

       

       

        Attachments

          Activity

            People

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            lee.jordan1 Lee Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Packages

                Version Package