[Seaside] Menu component - communicating with root component

Ramon Leon ramon.leon at allresnet.com
Sat Apr 19 22:48:15 UTC 2008

> In migrating a complex Magritte form to use 
> Magritte-scriptaculous, I successfully wire up the models so 
> that a change in one select drop down, changes items in other 
> fields in the same form. The child field which has changed 
> needs to trigger its form, so that all of changes in all of 
> the the relevant fields are received by the model, and then 
> scriptaculous update rendering, of not just its own 
> component, but one of its parents (at some level). Since it 
> is the components onChanged: 
> event and callback: which is triggered when the user has 
> changed the select box, it is the component which needs to 
> trigger the form and the update.  But as per usual, the inner 
> component has no means for dynamically discovering "what is 
> the form id that I am in", or asking the relevant parent to update.

Isn't that the whole point of an event based system?  Loosely coupled
systems are easier to compose into complex scenarios like this without
becoming bound to one scenario.  Rather than all the children having
intimate knowledge about how they're hooked together, you make the system
dead simple, keep all the children totally ignorant, have them just fire
events, and use the parent as a mediator to coordinate all the necessary

Then all the coupling is in the parent, having references to all its
children, it is in a perfect position to know in this particular
scenario/context how the children need to interact, so it subscribes to the
appropriate events and executes the necessary actions when those events are
fired.  The child need only trigger an event that something happened,
nothing more.  I just don't see why you feel the child needs to do more than

Ramon Leon

More information about the seaside mailing list