You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Max Pfingsthorn <m....@hippo.nl> on 2005/07/14 12:13:46 UTC
[cforms] convenience functions in flowscript event handlers?
Hi!
I'm getting to know cforms better everyday and I am very impressed. Currently, I am implementing a translation from schema to cforms. One constraint, which is already taken care of in cforms, is event handling. However, since I autogenerate widget IDs, I need to abstract the calls to event.source.lookupWidget() to include transformation of the names. Is there any way how I can define those convenience functions (e.g. lookup(event,'../../some/path')) once and use them in those flowscript snippets in <fd:on-value-changed/>, for example? Can I just include them in the sitemap like usual or are those scripts run in a different context?
Best regards,
Max Pfingsthorn
Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel +31 (0)20 5224466
-------------------------------------------------------------
m.pfingsthorn@hippo.nl / www.hippo.nl
--------------------------------------------------------------
Re: [cforms] convenience functions in flowscript event handlers?
Posted by "Carlos M. S. Bento Nogueira" <cm...@student.dei.uc.pt>.
Hi!
Check these code snippets from the DreamTeamExample
on webapps\cocoon\samples\blocks\forms\dreamteam
<fd:on-value-changed>
<fd:javascript>
// this script can be found in team.js
updateNameWidget(event);
</fd:javascript>
</fd:on-value-changed>
function updateNameWidget(event) {
var value = event.source.value;
var memberIdwidget = event.source.lookupWidget("myWidget");
}
Hope this helps.
Greetings,
CarlosN.
On Tue, 19 Jul 2005, Jean-Baptiste Quenot wrote:
> * Max Pfingsthorn:
>
>> Is there any way how I can define those convenience functions
>> (e.g. lookup(event,'../../some/path')) once and use them in
>> those flowscript snippets in <fd:on-value-changed/>, for
>> example? Can I just include them in the sitemap like usual or
>> are those scripts run in a different context?
>
> Just declare plain flowscript functions in a script loaded by the
> sitemap.
>
--
Re: [cforms] convenience functions in flowscript event handlers?
Posted by Jean-Baptiste Quenot <jb...@anyware-tech.com>.
* Max Pfingsthorn:
> Is there any way how I can define those convenience functions
> (e.g. lookup(event,'../../some/path')) once and use them in
> those flowscript snippets in <fd:on-value-changed/>, for
> example? Can I just include them in the sitemap like usual or
> are those scripts run in a different context?
Just declare plain flowscript functions in a script loaded by the
sitemap.
--
Jean-Baptiste Quenot
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/