Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 24763 invoked from network); 12 Jun 2007 08:50:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jun 2007 08:50:12 -0000 Received: (qmail 42118 invoked by uid 500); 12 Jun 2007 08:50:08 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 42054 invoked by uid 500); 12 Jun 2007 08:50:08 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: users@cocoon.apache.org List-Id: Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 42043 invoked by uid 99); 12 Jun 2007 08:50:08 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2007 01:50:08 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [87.118.111.53] (HELO mail.c-ware.de) (87.118.111.53) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 12 Jun 2007 01:50:04 -0700 Received: from [192.168.1.16] ([213.157.13.82]) by mail.c-ware.de with hMailServer ; Tue, 12 Jun 2007 10:49:43 +0200 Message-ID: <466E5E17.1060008@c-ware.de> Date: Tue, 12 Jun 2007 10:49:27 +0200 From: Christofer Dutz User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 To: users@cocoon.apache.org Subject: Re: ajax request and another cform in the same page References: <15786ae80705140105t403bedcdi50f0c7df8e1e7f9b@mail.gmail.com> <46483C55.7020800@c-ware.de> <15786ae80705150241t295ce2e8k4fb3bc6849afb2f9@mail.gmail.com> In-Reply-To: <15786ae80705150241t295ce2e8k4fb3bc6849afb2f9@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi Marc ... sorry for the extemely late response. I am currently doing a Project for a customer with very strict internet access policies, so I wasn't able to read this list. I think your problems are related to two different main problems. On the the one hand the (in your scenario #2 direct js ajax request + 1 cform on the page = bug) Cocoon finds out it's an ajax request and since an ajax-anabled form is in the conrinuation, it uses this --> Error in your fourth sample you have two CForms bound to one continuation. Since they are sticked to a default name the first form will overwrite the HashMap entry of the second --> Your first form dies. I have no really sattisfying suggestion. How about using dojo to pull in the search form after the main page is fiished. By this your CForm in the search div would have it's own continuation and would no longer interfere with the main one. As far as I understand the Submit-Code of cforms this should work, but I haven't tried it. Regards, Chris Marc Salvetti schrieb: > Hi Cristopher, > > thanks for your explanations, i think it's related to the same > problem, but i still have no idea on how to solve it. > i will try to give a more detailed explanation of what i'm trying to do : > > on one page on my site, i have links that send an ajax request > directly, outside of a cform, like this : > function sendReq(strReq) { > var req = createXHR(); > if (req) { > req.open("POST", strReq, true); // true = async > req.setRequestHeader("Content-Type", > "application/x-www-form-urlencoded; charset=UTF-8"); > req.onreadystatechange = function() { > if (req.readyState == 4) { > handleBrowserUpdate(req); > } > } > req.send("cocoon-ajax=true"); > } > } > this is received by the sitemap as an ajax request, somewhere in the > pipe i add some tags, transform this with the > browser-update transformer and send this back to the above js function > for browser updating. > > On some other pages, i have one cform with ajax turned on. > > Everything about this was working fine, until i tried to add a search > cform on every page of the website. > From what i understood to my problem, every time an ajax request is > sent by whatever means (internal cforms or direct js call), to the > server, the template generator tries to access the list of updated > widgets in the search cform and crash because this list hasn't been > initialized (NPE). > Apparently, the normal behavior is to initialize it after the form is > submited, which (wrongfully) assume that the ajax request was sent by > this form and not by some other means (another cform submit or a > direct js call) > > Or in other words :) > > direct js ajax request + no cform on the page = ok > direct js ajax request + 1 cform on the page = bug > cform ajax request + 1 cform on the page = ok > cform ajax request + 2 cform on the page = bug > > Marc > > 2007/5/14, Christofer Dutz >: > > Hi Marc, > > do I understand your problem correct, that you have two forms on your > page? This can be a problem. Since having a deeper cook into > JavaFlow I > could see, that the form instance is bound to an AvalonContext with a > fixed Name. This means, that one FormInstance should overwrite the > other > one. I don't exactyl know how this is implemented in FlowScript, but > since Generators like the SuggestionListGenerator also looks for a > hard-coded "CocoonFormsInstnce" object, I guess this is generally done > that way. > > Even if I know this doesn't help you solve the problem ... maybe it > helps you find it. > > Feel free to contact me. I will do my best to help you if you > provide a > little more detailed description of your problem / applicatoin setup / > intention. > > Chris > > Marc Salvetti schrieb: > > Hello, > > > > i'm running in a tricky problem while trying to add a search > form to > > every page of the site. > > Anytime an ajax request is sent, either by a cform widget on another > > form, or by a custom js function, i get an error 500 : > > *Couldn't evaluate expression cformsHelper.pushWidget (id)* > > resource://org/apache/cocoon/forms/generation/jx-macros.xml - > 45:52 // > > > > > > with a NPE in the pushWidget() method. > > Caused by: java.lang.NullPointerException > > at > org.apache.cocoon.forms.generation.JXMacrosHelper.pushWidget > (JXMacrosHelper.java:163) > > at > org.apache.cocoon.forms.generation.JXMacrosHelper.pushWidget(JXMacrosHelper.java > > :231) > > at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown > Source) > > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > > at java.lang.reflect.Method.invoke(Method.java:585) > > > > at > org.apache.commons.jexl.util.introspection.UberspectImpl$VelMethodImpl.invoke > (UberspectImpl.java:268) > > at > org.apache.commons.jexl.parser.ASTMethod.execute(ASTMethod.java:61) > > at org.apache.commons.jexl.parser.ASTReference.execute > > (ASTReference.java:68) > > at > org.apache.commons.jexl.parser.ASTReference.value(ASTReference.java:50) > > at > org.apache.commons.jexl.ExpressionImpl.evaluate(ExpressionImpl.java:86) > > at > org.apache.cocoon.components.expression.jexl.JexlExpression.evaluate > > (JexlExpression.java:47) > > ... 135 more > > > > > > By looking at the source, it appears that the member updatedWidgets > > has not been initialized before the call to pushWiget, which > cause the > > NPE. Apparently, this is initialized in the call to form.process(), > > every time the form is submited. > > > > But in my case, i don't submit this form, but either another form or > > no form at all, so i don't really know what i should do to fix this > > problem. > > > > Any help would be greatly appreciated, > > > > Marc > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > > For additional commands, e-mail: users-help@cocoon.apache.org > > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org