MyFaces Tomahawk
  1. MyFaces Tomahawk
  2. TOMAHAWK-1335

onclick attribute rendered twice for selectOneRow

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.1.8-SNAPSHOT
    • Fix Version/s: 1.1.8
    • Component/s: None
    • Labels:
      None
    • Environment:
      tomahawk-1.1.8-SNAPSHOT
      myfaces 1.1.7-SNAPSHOT
      tomahawk 6.0.16
      java 1.6.0

      Description

      onclick attribute for selectOneRadio is rendered twice.

      here's my sample jsf:

      <h:dataTable var="item" value="#

      {selectOneBean.data}

      ">
      <h:column>
      <t:selectOneRow onclick="someFunc()"/>
      </h:column>
      <h:column>
      <h:outputText value="#

      {item}

      "/>
      </h:column>
      </h:dataTable>

      here's my sample bean:
      public class SelectOneBean
      {
      ArrayList data;

      public SelectOneBean()

      { data = new ArrayList(); data.add("mars"); data.add("jupiter"); data.add("neptune"); data.add("mercury"); }

      public ArrayList getData()

      { return data; }

      }

      The html generated looks like this:
      <input type="radio" name="" id="_idJsp0:0:_idJsp2" value="_idJsp0:0:_idJsp2" onclick="someFunc()" onclick="someFunc()" /></td><td>mars</td></tr>

      There is no loss of functionality here, though. The javascript function will still get called (once).

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        8d 5h 47m 1 Leonardo Uribe 30/Sep/08 23:33
        Leonardo Uribe made changes -
        Fix Version/s 1.1.8 [ 12313507 ]
        Fix Version/s 1.1.8-SNAPSHOT [ 12313399 ]
        Leonardo Uribe made changes -
        Resolution Fixed [ 1 ]
        Assignee Leonardo Uribe [ lu4242 ]
        Fix Version/s 1.1.8-SNAPSHOT [ 12313399 ]
        Status Open [ 1 ] Closed [ 6 ]
        Hide
        Leonardo Uribe added a comment -

        Thanks to Paul Rivera for provide this patch

        Show
        Leonardo Uribe added a comment - Thanks to Paul Rivera for provide this patch
        Hide
        Paul Rivera added a comment -

        I've attached a patch for this above. The patch just removes this line from SelectOneRowRenderer:

        • HtmlRendererUtils.renderHTMLAttributes(writer, row, new String[] {HTML.ONCLICK_ATTR}

          );

        No need for this because ONCLICK_ATTR is already in HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED.

        I've checked for both myfaces shared 2.0.x and 3.0.x. This is how ONCLICK_ATTR is included in HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED:

        MYFACES SHARED 2.0.x
        INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED
        INPUT_ATTRIBUTES,
        ALIGN_ATTR,
        ALT_ATTR,
        CHECKED_ATTR,
        DATAFLD_ATTR,
        DATASRC_ATTR,
        DATAFORMATAS_ATTR,
        MAXLENGTH_ATTR,
        READONLY_ATTR,
        SIZE_ATTR,
        AUTOCOMPLETE_ATTR
        COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
        COMMON_PASSTROUGH_ATTRIBUTES,
        EVENT_HANDLER_ATTRIBUTES,
        EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
        new String[]

        {ONCLICK_ATTR}); --------------------------> onclick already here!
        UNIVERSAL_ATTRIBUTES);
        COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
        COMMON_FIELD_EVENT_ATTRIBUTES);


        MYFACES SHARED 3.0.x
        INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED
        INPUT_ATTRIBUTES,
        ALIGN_ATTR,
        ALT_ATTR,
        CHECKED_ATTR,
        MAXLENGTH_ATTR,
        READONLY_ATTR,
        SIZE_ATTR
        COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED);
        COMMON_PASSTROUGH_ATTRIBUTES,
        EVENT_HANDLER_ATTRIBUTES,
        EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK,
        new String[] {ONCLICK_ATTR}

        ); --------------------------> onclick already here!
        UNIVERSAL_ATTRIBUTES);
        COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED,
        COMMON_FIELD_EVENT_ATTRIBUTES);

        Show
        Paul Rivera added a comment - I've attached a patch for this above. The patch just removes this line from SelectOneRowRenderer: HtmlRendererUtils.renderHTMLAttributes(writer, row, new String[] {HTML.ONCLICK_ATTR} ); No need for this because ONCLICK_ATTR is already in HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED. I've checked for both myfaces shared 2.0.x and 3.0.x. This is how ONCLICK_ATTR is included in HTML.INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED: MYFACES SHARED 2.0.x INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED INPUT_ATTRIBUTES, ALIGN_ATTR, ALT_ATTR, CHECKED_ATTR, DATAFLD_ATTR, DATASRC_ATTR, DATAFORMATAS_ATTR, MAXLENGTH_ATTR, READONLY_ATTR, SIZE_ATTR, AUTOCOMPLETE_ATTR COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED); COMMON_PASSTROUGH_ATTRIBUTES, EVENT_HANDLER_ATTRIBUTES, EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK, new String[] {ONCLICK_ATTR}); --------------------------> onclick already here! UNIVERSAL_ATTRIBUTES); COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED, COMMON_FIELD_EVENT_ATTRIBUTES); MYFACES SHARED 3.0.x INPUT_PASSTHROUGH_ATTRIBUTES_WITHOUT_DISABLED INPUT_ATTRIBUTES, ALIGN_ATTR, ALT_ATTR, CHECKED_ATTR, MAXLENGTH_ATTR, READONLY_ATTR, SIZE_ATTR COMMON_FIELD_PASSTROUGH_ATTRIBUTES_WITHOUT_DISABLED); COMMON_PASSTROUGH_ATTRIBUTES, EVENT_HANDLER_ATTRIBUTES, EVENT_HANDLER_ATTRIBUTES_WITHOUT_ONCLICK, new String[] {ONCLICK_ATTR} ); --------------------------> onclick already here! UNIVERSAL_ATTRIBUTES); COMMON_FIELD_ATTRIBUTES_WITHOUT_DISABLED, COMMON_FIELD_EVENT_ATTRIBUTES);
        Paul Rivera made changes -
        Field Original Value New Value
        Attachment SelectOneRowRenderer.patch [ 12390664 ]
        Paul Rivera created issue -

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Paul Rivera
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development