ICEfaces
  1. ICEfaces
  2. ICE-3084

<ice:selectOneMenu/> with empty first value causing unnecessary DOM updates

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7
    • Fix Version/s: 1.7.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      ICEfaces 1.7 + Liferay 4.2.2 + Tomcat 6.0.16

      Description

      I don't know this for sure, but I suspect this isn't just a portlet problem, but a webapp problem in general.

      Webapp developers typically have <ice:selectOneMenu/> components that are bound to a database column. Often times, the database column is NULL, and therefore has no initial value. In this case, a typical thing to do is to make the first SelectItem be something like this:

           selectItems.add(new SelectItem("", "-- Select --"));

      However, when this is used done on a page with other fields that have partialSubmit=true, the DOM for the selectItems is always updated, even though the selectItems in the list haven't changed.

      In order to reproduce this problem, follow these steps:

      1. Download the Liferay 4.4.2 + Tomcat 6.0.16 bundle
      2. Run startup.bat
      3. Download the attached .WAR and copy it to your $HOME/username/liferay/deploy folder
      4. Monitor the Tomcat console log to make sure the portlet deploys correctly
      5. Startup FireFox
      6. Visit http://localhost:8080
      7. Login to the portal as test@liferay.com with password test
      8. Navigate to the private pages in "My Community"
      9. Add a new portal page named "ICE"
      10. Click on the new ICE tab
      11. Add the portlet to the page (found under the samples category)
      12. Startup FireBug
      13. Click on the FireBug CONSOLE tab
      14. In the FireBug Search box, type: applied update
           ** note that this will filter the FireBug console so that only DOM updates will be shown **
      15. Click in the "First Name" field
      16. Press the tab key on the keyboard to cause an onblur event

      If the bug is fixed, there will be no DOM updates shown in the FireBug console.

      If the bug is still there, aDOM update like the following will appear in the FireBug console:

      <select class="iceSelOneMnu portlet-form-field" id="_ice_" name="_ice_:_id2:_id5:0:phoneNumberType" onblur="setFocus(&#39;&#39;);" onchange="setFocus(&#39;&#39;);iceSubmitPartial(form, this, event);" onfocus="setFocus(this.id);" size="1">...</select>

      This is a bug because the model has not changed with respect to the value of the <ice:selectOneMenu/> component.

      Note that this only happens with the first SelectItem has an EMPTY string value. If a value like "foo" is passed, then the DOM update doesn't happen.

        Activity

        Neil Griffin created issue -
        Neil Griffin made changes -
        Field Original Value New Value
        Attachment ice-3084-portlet-4.4.2.1.war [ 10986 ]
        Ken Fyten made changes -
        Fix Version/s 1.7.1 [ 10122 ]
        Assignee Priority P2
        Assignee Adnan Durrani [ adnan.durrani ]
        Adnan Durrani made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Adnan Durrani made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P2
        Assignee Adnan Durrani [ adnan.durrani ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Neil Griffin
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: