Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 93947 invoked from network); 20 Jan 2004 13:13:33 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 20 Jan 2004 13:13:33 -0000 Received: (qmail 28238 invoked by uid 500); 20 Jan 2004 13:13:27 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 28216 invoked by uid 500); 20 Jan 2004 13:13:27 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 28202 invoked from network); 20 Jan 2004 13:13:27 -0000 Received: from unknown (HELO main.gmane.org) (80.91.224.249) by daedalus.apache.org with SMTP; 20 Jan 2004 13:13:27 -0000 Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Aivh9-00060T-00 for ; Tue, 20 Jan 2004 14:13:27 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: dev@cocoon.apache.org Received: from sea.gmane.org ([80.91.224.252]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Aivh7-00060K-00 for ; Tue, 20 Jan 2004 14:13:25 +0100 Received: from news by sea.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Aivh7-0003LG-00 for ; Tue, 20 Jan 2004 14:13:25 +0100 From: Joerg Heinicke Subject: Re: [Woody] observations, issues, questions, best practices Date: Tue, 20 Jan 2004 13:13:25 +0000 (UTC) Lines: 27 Message-ID: References: <4005CCA5.1030409@gmx.de> <400C4254.8000505@verizon.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 217.69.240.162 (Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113) Sender: news X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Joerg Heinicke ewerk.com> writes: > 05: var formtype = cocoon.parameters["formtype"]; > ... > 19: var functionName = "display" + formtype; > 20: print(functionName); > 21: var function = this[functionName]; > > SyntaxError: missing variable name > (file:/C:/Projekte/cocoon-2.1/build/webapp/samples/erak/flow/form.js; > line 21) > > The print in line 20 is not executed, another print before writing just > 'starting form handling' is neither, so it's something like preparsing. At > that time functionName is of course not available. Changing the above line > 19 - 21 to just var function = this["display" + formtype]; works. Can you > tell me why? *argh* I had the idea 30 seconds after writing it: function is a preserved word. What I had yesterday working was not var function = this["display" + formtype]; but this["display" + formtype].apply(form, args); directly. Sometimes one should simply copy & paste code and not try to beautify the code ... Joerg