Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 89472 invoked from network); 16 Jun 2010 13:26:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 16 Jun 2010 13:26:46 -0000 Received: (qmail 34591 invoked by uid 500); 16 Jun 2010 13:26:46 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 34385 invoked by uid 500); 16 Jun 2010 13:26:44 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 34378 invoked by uid 99); 16 Jun 2010 13:26:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jun 2010 13:26:44 +0000 X-ASF-Spam-Status: No, hits=-1630.4 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jun 2010 13:26:43 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o5GDQNPv023799 for ; Wed, 16 Jun 2010 13:26:23 GMT Message-ID: <26484266.28461276694783468.JavaMail.jira@thor> Date: Wed, 16 Jun 2010 09:26:23 -0400 (EDT) From: "Werner Punz (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Commented: (MYFACES-2755) this.id is undefined in jsf.ajax.request (regression from 2.0.0) In-Reply-To: <14950289.27991276691962636.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MYFACES-2755?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12879335#action_12879335 ] Werner Punz commented on MYFACES-2755: -------------------------------------- Ok this is not entirely javascript related at least not in my part of the code is the problem here is following: onclick = "jsf.ajax.request(this, event, { execute: this.id, render: 'counter' }); return false;" is mapped into var cf = function(){jsf.ajax.request(this, event, { execute: this.id, render: 'counter' }); return false;};var oamSF = function(){};return (cf()==false)? false : oamSF(); which reassigns the this scope (whoever has written that code did not take that into consideration. the problem then is that this is assigned to the function cf which then tries to determine the original this.id id value. But now that this points towards the function id is undefined. A quick workaround to fix that problem would be to use one of our impl functions the call would look like: cf myfaces._impl._util._Lang.hitch(this, (){jsf.ajax.request(this, event, { execute: this.id, render: 'counter' }); return false;}); this would reassign the this to the original scope. if you do not want to go for the helper in our impls Lang package then a workaround would be to go for following code: var cf = function(){jsf.ajax.request(this, event, { execute: this.id, render: 'counter' }); return false;};var oamSF = function(){};return (cf.apply(this, [])==false)? false : oamSF.apply(this, []); This would drag the scope also in. Cheers Werner Leonardo or Jakob can you take over you probably know fastest where the related code is. > this.id is undefined in jsf.ajax.request (regression from 2.0.0) > ---------------------------------------------------------------- > > Key: MYFACES-2755 > URL: https://issues.apache.org/jira/browse/MYFACES-2755 > Project: MyFaces Core > Issue Type: Bug > Components: JSR-314 > Affects Versions: 2.0.1 > Reporter: Michael Concini > > With the new javascript, we now wrapper calls into jsf.ajax.request with a function call. So for example this: > onclick="jsf.ajax.request(this, event, { execute: this.id, render: 'counter' }); return false;" > actionListener="#{counter.increment}" /> > would be rendered as this: > onclick="var cf = function(){jsf.ajax.request(this, event, { execute: this.id, render: 'counter' }); return false;};var oamSF = function(){};return (cf()==false)? false : oamSF();" /> > The problem is that we've broken the reference to this.id as it is undefined at the function's scope. This works fine in both the 2.0.0 release as well as Mojarra. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.