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

Alloy UI portlet does not count characters correctly, showing a red border when one character remains.



      Alloy UI portlet does not count characters correctly, showing a red border when one character remains. I think this is a bug because if a character remains, there should not be a red border.

      Steps to reproduce:
      1) Start a clean bundle of Liferay 6.2
      2) *Using the 6.2 Plugins SDk, open a command prompt in the portlets folder and run:

      create alloy-test "Alloy Test"

      3) In the new alloy-test-portlet folder, go to docroot/js/ edit main.js and add this code (per http://alloyui.com/examples/char-counter/real-world/):

        function(Y) {
          new Y.CharCounter(
              counter: '#myCounter',
              input: '#myTextarea',
              maxLength: 140,
              on: {
                maxLength: function(event) {
                  alert('The max length limit was reached');

      4) In alloy-test-portlet/docroot edit view.jsp and add:

      <textarea id="myTextarea"></textarea>
      <p id="myCounter"></p>

      5) Open a command prompt from alloy-test-portlet and run

       ant war

      6) Make sure the portlet WAR is built in the dist folder of the 6.2 plugins SDK
      7) Start the 6.2 bundle
      8) Deploy a license and the alloy-test-portlet.war
      9) Login and add the Alloy Test portlet to the home page.
      10) refresh the home page
      11) copy this text to the text box:

      Whitespace characters used within "textarea" like elements 
      are treated as one character 
      but can cause validation issues take  for example

      I am attaching my custom portlet built using the above steps.

      Expected: There is one character remaining and no red border because the character limit is not exceeded.
      Actual: There is one character remaining but there is a red border.

      Branch 62x - 90722f8d013f84b6c1a9f82b97dc4a7be0636aca: Reproduced
      Master - 1ac80c24533c9638edb57ef9ed35b3e80ea89d5a: Fixed


        1. alloyUI-portlet-
          19 kB
        2. failed.png
          6 kB
        3. reproduced.png
          5 kB

        Issue Links



              yvonne.han Yvonne Han
              jonathan.mak Jonathan Mak (Inactive)
              Kiyoshi Lee Kiyoshi Lee
              0 Vote for this issue
              3 Start watching this issue


                8 years, 28 weeks, 5 days ago


                  Version Package
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M3