Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 22596 invoked from network); 23 Jan 2006 12:39:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 23 Jan 2006 12:39:45 -0000 Received: (qmail 25659 invoked by uid 500); 23 Jan 2006 12:39:39 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 25627 invoked by uid 500); 23 Jan 2006 12:39:39 -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 25610 invoked by uid 99); 23 Jan 2006 12:39:39 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2006 04:39:39 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [62.40.176.118] (HELO hp.gefi.at) (62.40.176.118) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 23 Jan 2006 04:39:38 -0800 Received: from leia.gefi.at (werner@leia.gefi.home [192.168.1.14]) by hp.gefi.at (8.9.3+3.2W/8.9.3/Debian 8.9.3-21) with ESMTP id NAA24365 for ; Mon, 23 Jan 2006 13:39:16 +0100 X-Authentication-Warning: hp.gefi.at: Host werner@leia.gefi.home [192.168.1.14] claimed to be leia.gefi.at Subject: Re: [CFORMS] dynamic binding From: werner Reply-To: werner@gefi.at To: users@cocoon.apache.org In-Reply-To: <43D0ECE8.80104@lojjic.net> References: <1137685640.7150.7.camel@leia.gefi.at> <60954.199.117.205.100.1137695239.squirrel@mail.lojjic.net> <1137741670.7150.16.camel@leia.gefi.at> <43D0ECE8.80104@lojjic.net> Content-Type: multipart/alternative; boundary="=-uxzbxeCp+xzKCkv/flF0" Organization: GEFi Informationstechnik und Datenservice Date: Mon, 23 Jan 2006 12:38:19 +0100 Message-Id: <1138016299.15991.13.camel@leia.gefi.at> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --=-uxzbxeCp+xzKCkv/flF0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Thanks for your answer. I think that Bruno's suggestion (passing parameter in form.load instead() of form.createBinding() ) is perfect for me. Werner Am Freitag, den 20.01.2006, 07:00 -0700 schrieb Jason Johnston: > werner wrote: > > Am Donnerstag, den 19.01.2006, 11:27 -0700 schrieb Jason Johnston: > > > >>> Does anybody know a clean approach for dynamic binding. For example it > >>> would be nice to use a JXTemplate for the binding and pass it some vars > >>> like it works with showForm: > >>> > >>> form.createBinding("binding.jx", {"param1": somevalue, "param2": > >>> somevalue}); > >>> > >>> I know it's possible to solve this with a special pipline and call the > >>> binding with /binding.jx/param1/param2 > >>> But that's ugly IMO. > >> > > > > Thanks for your answer Jason. > > > >> > >>Looks like somebody posted a patch for this feature: > >>https://issues.apache.org/jira/browse/COCOON-1418 > >> > >>In the meantime you can use request attributes or parameters as a > >>transport for your data. > >> > > > > That's how I'm doing it right now. But in some cases that is not enough. > > Especially when you want to pass more than 3 parameters to the binding. > > You should be able to pass an arbitrary number of attributes. I was > thinking something like: > > cocoon.request.setAttribute("param1", "value1"); > cocoon.request.setAttribute("param2", "value2"); > //...ad nauseum > form.createBinding("cocoon://binding.jx"); > > ...then in your jx template: > > > > etc... > > This is untested but seems to me like it should work. > > If you didn't want to pollute the request object with so many attributes > you might be able to use a single request attribute with a JS object as > its value: c.r.setAttribute("data", {param1:"value1", param2:"value2"}); > you'd have to figure out how to traverse the JS object within the > template... I think JXPath expressions could do so. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > --=-uxzbxeCp+xzKCkv/flF0 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit Thanks for your answer. I think that Bruno's suggestion (passing parameter in form.load instead() of form.createBinding() ) is perfect for me.

Werner


Am Freitag, den 20.01.2006, 07:00 -0700 schrieb Jason Johnston:
werner wrote:
> Am Donnerstag, den 19.01.2006, 11:27 -0700 schrieb Jason Johnston:
> 
>>> Does anybody know a clean approach for dynamic binding. For example it
>>> would be nice to use a JXTemplate for the binding and pass it some vars
>>> like it works with showForm:
>>>
>>> form.createBinding("binding.jx", {"param1": somevalue, "param2":
>>> somevalue});
>>>
>>> I know it's possible to solve this with a special pipline and call the
>>> binding with /binding.jx/param1/param2
>>> But that's ugly IMO.
>>
> 
> Thanks for your answer Jason.
> 
>>
>>Looks like somebody posted a patch for this feature:
>>https://issues.apache.org/jira/browse/COCOON-1418
>>
>>In the meantime you can use request attributes or parameters as a
>>transport for your data.
>>
> 
> That's how I'm doing it right now. But in some cases that is not enough. 
> Especially when you want to pass more than 3 parameters to the binding.

You should be able to pass an arbitrary number of attributes.  I was 
thinking something like:

cocoon.request.setAttribute("param1", "value1");
cocoon.request.setAttribute("param2", "value2");
//...ad nauseum
form.createBinding("cocoon://binding.jx");

...then in your jx template:

<jx:set var="param1" value="${cocoon.request.getAttribute('param1')}" />
<jx:set var="param2" value="${cocoon.request.getAttribute('param2')}" />
etc...

This is untested but seems to me like it should work.

If you didn't want to pollute the request object with so many attributes 
you might be able to use a single request attribute with a JS object as 
its value: c.r.setAttribute("data", {param1:"value1", param2:"value2"}); 
you'd have to figure out how to traverse the JS object within the 
template... I think JXPath expressions could do so.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


--=-uxzbxeCp+xzKCkv/flF0--