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

timePicker.getTime() from liferay-ui:input-time does not retrieve date if called before user interaction



      The liferay-ui:input-time tag has an associated A.DatePicker object, this object is extended with a method, getTime(), which is expected to return the hour and minutes represented in the input. This method, however, returns null when called before a user interaction.

      Steps to reproduce:

      1. Create a portlet with a JSP file that creates a liferay-ui:input-time instance, as the one below:
        <liferay-ui:input-time name="test"
            hourParam="hour" minuteParam="minute" amPmParam="amPm" />
      2. Add a button to the JSP file. When clicked, it should retrieve the time from the A.TimePicker with getTime() and display it, as the one below:
        <button onClick="alert(Liferay.component('<portlet:namespace />testTimePicker').getTime());">Get time</button>
      3. Deploy the previous portlet. Add it to a page.
      4. Click on the button. Observe the displayed value.
      5. Change the value in the time input.
      6. Click on the button. Observe the displayed value.

      Expected results

      • At steps 4 and 6, the time displayed in the input should have been displayed in the alert dialog.

      Actual results

      • At step 4, null is displayed at the alert dialog. The correct value is displayed at step 6.

      The result is reproduced in the GIF animation below:


        1. input-time.gif
          2.77 MB
        2. time-portlet.zip
          24 kB
        3. time-portlet-
          54 kB
        4. view.jsp
          0.3 kB

        Issue Links



              shitian.zhang Shitian "Shelton" Zhang (Inactive)
              adam.brandizzi Adam Brandizzi
              Kiyoshi Lee Kiyoshi Lee
              0 Vote for this issue
              1 Start watching this issue


                7 years, 27 weeks, 4 days ago


                  Version Package
                  6.2.4 CE GA5
                  6.2.X EE
                  7.0.0 M1