[Seaside] Refresh list / combos when another has been selected?

Diego Lont diego.lont at delware.nl
Tue Dec 10 10:27:36 UTC 2013

Hi Mariano,

A bit longer answer.

I added an example to the QC Magritte Demo to show how this can be done. I added it to the last demo (form demo).

There are actual several ways to do this in QC Magritte, but I implemented what I think is the most elegant one for this problem.

First you need to make sure the QC Magritte stuff is used, so in the domain object we implement to following 2 methods:

The normal memento is not aware of the class and will not process and domain rules, other than validations set in the descriptions. We need to update the values of other objects as well, so this allows for influences and hidden fields.

setDefaultsFor: aContainer
		componentRenderer: QCGroupedFormRenderer;
		componentClass: QCContainerComponent;
		descriptionBuilder: QCDescriptionFlattener;

This basically overrides the default component class, component renderer and adds a description builder.

The component renderer adds the AJAX stuff. This renderer adds a callback to each element of a group, that re renders the group when it is changed. Also it allows for groups to be collapsed by the user.

The component class makes sure the description builder is used to process the description. The description builder you probably don't need, but it processes the description, before it is shown, allowing for defaults, security and such. The descriptionFlattener is expanding relations to groups, allowing to use nested objects. I.E. a person has an address, and you want to model this as a different object. But when you edit a person, you usually want to be able to change the address, without switching pages.

If you do not want to use the description builder, setting the component renderer will suffice.

For more information on QC Magritte see: http://smalltalkhub.com/#!/~DiegoLont/QCMagritte


On Dec 9, 2013, at 9:28 PM, Mariano Martinez Peck wrote:

> Hi guys. I have lots of seaside forms with magritte. One problem I have now is that I want to refresh the form once an item from a combo list has been selected. For example, the typical set country / state (or provice). In other words...I want to refresh the form once certain fields are choose. 
> I did not find this functionality available in Magritte-Seaside. I am missing something?
> Thanks in advance, 
> -- 
> Mariano
> http://marianopeck.wordpress.com
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20131210/67085abc/attachment.htm

More information about the seaside mailing list