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

Date Picker doesn't show up for Date type Custom Field with space in its name: manually entered value is not saved into the database



      1. Create 2 Custom Fields for an arbitrary asset type (e.g. Web Content Article)
            First field: Key = Custom Field; Type = Date; Default Value -> 01/01/1970; Hidden = False; Visible with Update = True; Searchability = As Keyword
            Second field: Key = Custom_Field; Type = Date; Default Value -> 01/01/1971; Hidden = False; Visible with Update = True; Searchability = As Keyword
      2. Go to Admin/Content/ and select the asset type you added the custom fields for
      3. Go to Custom Fields section. Observe:
        Click into the first input field: Date Picker doesn't show up
        Click into the second input field: Date Picker shows up
      4. Click into both input fields and enter a custom date for each one
      5. Save
      6. Open the content again:
        Excepted result: values entered are saved and restored
        Actual result: the value you entered into the first Custom Field (the one with space in its key) is lost, the default value (date) is displayed

      Reproduction note
      DDL (DDM) and Web Content Structures are not affected: when you create a structure or a data definition with a Date field with a space in its name, the space will be replaced by an underscore ("_"). (On master, you cannot rename a field on the UI to contain a space. On 62x, you can, but it will be replaced upon saving.)
      Therefore, the call for "escapeAttribute" from /input_date/page.jsp won't produce a non-valid "nameId" that is used as "trigger" by the Date Picker JS component.

      Technical background Caused by LPS-50592:

      Change in https://github.com/liferay/liferay-portal/commit/790bbbd64d4a88e14de6bae9c05f1aaf803af794 (https://github.com/liferay/liferay-portal/blob/master/portal-web/docroot/html/taglib/ui/input_date/page.jsp#L40-43) is invalid: space and other special fields are not allowed in DOM IDs, though, escapeAttribute will replace "_" with its HTML entity and it will be resolved by the browser, so the DOM will contain

      _15_ExpandoAttribute--Custom Field--Date

      field, though we pass the escaped value string to the Date Picker component: "nameId" -->

      _15_ExpandoAttribute--Custom Field--Date

      , that is, won't match.

      Only this commit https://github.com/liferay/liferay-portal/commit/aaf89550ffb397ca365f429ee4aad1bd89150252 (the change in the date.ftl) would have been enough to fix LPS-50592.


          Issue Links



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


                • Created:
                  Days since last comment:
                  5 years, 12 weeks, 3 days ago


                  Version Package
                  6.2.4 CE GA5
                  6.2.X EE
                  7.0.0 M6