ICEfaces
  1. ICEfaces
  2. ICE-5632

ValueChangeListener gets called twice when clicking on label for selectOneRadio

    Details

      Description

      The ValueChangeListener is called twice when clicking on the selectOneRadio components label and standardRequestScope=true.

      It is called only once when clicking on the actual button. Also if using the ICEfaces extending request scope or session scope the listener is always called once.
      1. screenshot-01.png
        173 kB
      2. screenshot-02.png
        180 kB

        Issue Links

          Activity

          Hide
          Ted Goddard added a comment -

          This does not appear to be a framework issue. The following HTML example also displays two "click" alerts:
          <html>
          <body>
          <fieldset onclick="alert('click');">

          <input type="radio" id="coke" value="Coke" />
          <label for="coke">coke</label>

          <input id="sprite" type="radio" value="Sprite" />
          <label for="sprite">sprite</label>

          </fieldset>
          </body>
          </html>

          If the onclick handler is applied to each label, however a single alert is displayed, so it may be desirable to modify the component renderer to apply the onclick attribute in this way.

          Show
          Ted Goddard added a comment - This does not appear to be a framework issue. The following HTML example also displays two "click" alerts: <html> <body> <fieldset onclick="alert('click');"> <input type="radio" id="coke" value="Coke" /> <label for="coke">coke</label> <input id="sprite" type="radio" value="Sprite" /> <label for="sprite">sprite</label> </fieldset> </body> </html> If the onclick handler is applied to each label, however a single alert is displayed, so it may be desirable to modify the component renderer to apply the onclick attribute in this way.
          Hide
          Ted Goddard added a comment -

          onmouseup seems to behave as expected. onchange does not appear to be fired for the fieldset.

          The recommendation is to change partialSubmit behavior for selectOneRadio to be triggered by onmouseup.

          There is a comment above that the behavior is affected by the scope of the bean; this is likely a result of how two very rapid events affect the application – the root cause is that essentially duplicate events are generated by the browser for fieldset onclick.

          Show
          Ted Goddard added a comment - onmouseup seems to behave as expected. onchange does not appear to be fired for the fieldset. The recommendation is to change partialSubmit behavior for selectOneRadio to be triggered by onmouseup. There is a comment above that the behavior is affected by the scope of the bean; this is likely a result of how two very rapid events affect the application – the root cause is that essentially duplicate events are generated by the browser for fieldset onclick.
          Hide
          Ted Goddard added a comment -

          Assigning to Ken to assign to component team if the partialSubmit trigger for selectOneRadio is to be changed.

          Show
          Ted Goddard added a comment - Assigning to Ken to assign to component team if the partialSubmit trigger for selectOneRadio is to be changed.
          Hide
          yip.ng added a comment -

          Changed onclick to onmouseup as suggested. See screenshots 1 and 2 for before and after change.

          Revision: 23029


          Modified : /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java

          Revision: 23031


          Modified : /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java

          Show
          yip.ng added a comment - Changed onclick to onmouseup as suggested. See screenshots 1 and 2 for before and after change. Revision: 23029 Modified : /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java Revision: 23031 Modified : /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java
          Hide
          Ken Fyten added a comment - - edited

          This change seems related to a new regression failure:

          New Failures:
          ICE-751 load the application (problem reproducible on component-showcase selection page, selection is Menubar, selection in Media, selection in datapaginator, selection in splitpanel, selection in stackingPanel etc )
          select a fruit- apple (selection is not displayed)
          Now select another fruit -orange (apple is displayed instead of orange)

          Show
          Ken Fyten added a comment - - edited This change seems related to a new regression failure: New Failures: ICE-751 load the application (problem reproducible on component-showcase selection page, selection is Menubar, selection in Media, selection in datapaginator, selection in splitpanel, selection in stackingPanel etc ) select a fruit- apple (selection is not displayed) Now select another fruit -orange (apple is displayed instead of orange)
          Hide
          Mark Collette added a comment -

          With the component-showcase / Table / Row selection example, when you click between modes, it takes two clicks to register. The first click does a submit, but the ice.event.target is not always set, although ice.event.captured is properly set. And the value for the radio is the previous value.

          From the MSDN reference for mouse events, it says the onmouseup happens before onclick, so perhaps onclick has the actual value change.

          Show
          Mark Collette added a comment - With the component-showcase / Table / Row selection example, when you click between modes, it takes two clicks to register. The first click does a submit, but the ice.event.target is not always set, although ice.event.captured is properly set. And the value for the radio is the previous value. From the MSDN reference for mouse events, it says the onmouseup happens before onclick, so perhaps onclick has the actual value change.
          Hide
          yip.ng added a comment - - edited

          Fixed by moving onclick handler from fieldset to radio buttons. No need to handle label element. Tested on IE 6, 7, 8 and FF.

          From http://www.w3schools.com/tags/tag_label.asp :

          The label element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the label element, it toggles the control.

          Revision: 23052


          Modified : /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java
          Modified : /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/RadioRenderer.java
          Modified : /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java

          Revision: 23053


          Modified : /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java
          Modified : /icefaces2/trunk/icefaces/compat/core/src/main/java/com/icesoft/faces/renderkit/dom_html_basic/RadioRenderer.java
          Modified : /icefaces2/trunk/icefaces/compat/core/src/main/java/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java

          Show
          yip.ng added a comment - - edited Fixed by moving onclick handler from fieldset to radio buttons. No need to handle label element. Tested on IE 6, 7, 8 and FF. From http://www.w3schools.com/tags/tag_label.asp : The label element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the label element, it toggles the control. Revision: 23052 Modified : /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java Modified : /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/RadioRenderer.java Modified : /icefaces/trunk/icefaces/core/src/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java Revision: 23053 Modified : /icefaces2/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/HtmlSelectOneRadio.java Modified : /icefaces2/trunk/icefaces/compat/core/src/main/java/com/icesoft/faces/renderkit/dom_html_basic/RadioRenderer.java Modified : /icefaces2/trunk/icefaces/compat/core/src/main/java/com/icesoft/faces/renderkit/dom_html_basic/SelectManyCheckboxListRenderer.java

            People

            • Assignee:
              yip.ng
              Reporter:
              Arran Mccullough
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: