[ 
https://issues.apache.org/jira/browse/MYFACES-3584?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Leonardo Uribe resolved MYFACES-3584.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.9
                   2.0.15
         Assignee: Leonardo Uribe

I just add the check to force id rendering if onclick property is defined.
                
> h:commandLink renders onclick JavaScript referencing a non-existent HTML id
> ---------------------------------------------------------------------------
>
>                 Key: MYFACES-3584
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3584
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.8
>            Reporter: Mathias Werlitz
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.15, 2.1.9
>
>
> If you do not set the id of a h:commandLink explicitly the generated onclick 
> JavaScript references an HTML id (client id of the command link) that was no 
> rendered in the response.
> Example:
> <h:form id="form">
>   <script>
>     function myFunction(element) {
>         alert(element.id);
>         return false;
>     }
>   </script>
>   <h:commandLink value="commandLink" onclick="return myFunction(this);" />
> </h:form>
> renders:
> <a href="#" onclick="return 
> jsf.util.chain(document.getElementById('form:j_id_6'), event,'return 
> myFunction(this);', 'return 
> myfaces.oam.submitForm(\'form\',\'form:j_id_6\');');">commandLink</a>
> The HTML id "form:j_id_6" is referenced here in script, but is not rendered. 
> This also happens if no onclick is defined explicitly for h:commandLink.
> In this example passing the "this"-JavaScript reference inside the JS 
> function will be the window object. Thats an error and a fallback if the 
> supplied id could not be found. The link DOM element would be expected here.
> If the id of the h:commandLink is set explicitly, the "this"-JavaScript 
> reference inside the JS function will be the correct link DOM element.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to