Reinhard Poetz wrote:

Sylvain Wallez wrote:

 - event handlers in libraries are allowed, but I don't think they
   make sense there (e.g. on-value-changed)


Why not? A library may for example contain a group of related widgets with some interactions between them, e.g. a reusable car selector :-)


[Moving this discussion between Sylvain, Max and me to cocoon-dev as it's of general interest]

my wording was bad: I think they would make sense but I think the implementation is a bit difficult or at least this can cause strange errors. Maybe I'm wrong ...

Here a simple example why I don't think that it can work with simply using the eventhandler code of the library in the form definition.

LIBRARY

 libWidget1 has eventhandler that references libWidget2
 libWidget2

FORM DEFINITION (imports above library)

 myWidget1 extends libWidget1

What happens now? The form doesn't has a reference to libWidget2. And if it had, how could the reference in the event handler code can work as it probably has a different name than libWidget2 or is reused several times in the form definition.


Good point. We may allow on-change listeners in form libraries only in fields that aren't top-level, i.e. part of a group.

Now aren't there any valid use cases where a field has an on-change that only acts on itself?

Sylvain

--
Sylvain Wallez                        Anyware Technologies
http://people.apache.org/~sylvain     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director

Reply via email to