[Seaside] Help with dependent components.

Fritz Schenk intrader.intrader at gmail.com
Sat May 8 21:35:35 UTC 2010

I have implemented the following use case using Javascript and ASP.net:

1. One listbox A
2. A textbox - displays a computation dependant on listbox A's selection
3. A listbox B - provides selections dependent on the selection of 
listbox A. The contents of listbox B are provided via AJAX.
4. The action seems immediate at the browsers.

The solution entails setting up a publish/subscribe pattern - the 
textbox and listbox B suscribe from a publisher that watches for changes 
on listbox A.

I have looked at Announcements, and envision a possible solution using 

However, a server trip seems to be inevitable with the callbacks (apart 
from the listbox B AJAX contents); also, if more than one callback is 
involved, they are sequentially executed at the server. The requirement 
suggests that this should operate at the client without server trip.

For example:
        "Radio Buttons"
        html text: 'Gender: '.
        group := html radioGroup.
        group radioButton
            selected: self contact isMale;
            callback: [ self contact beMale].
        html text: 'Male'.
        group radioButton
            selected: self contact isFemale;
            callback: [ self contact beFemale].
        html text: 'Female'.
        html break.
         "Drop-Down Menu"
         html text: 'Gender: '.
         html select
           size: 2;
            list: #(#Male #Female);
            selected: self contact gender;
            callback: [ :value |
                self contact inspect.
                value = #Male
                   ifTrue: [ self contact beMale ]
                   ifFalse: [self contact beFemale ]].
is an incorrect version of two views of gender which should ideally be 
synchronized. However the callbacks execute sequentially, while the 
closure in the dropdown obtains previous values, an do not see the new 
value set by the callback of the radioButton.

I would like suggestions on how to approach this common use case. There 
are many such cases while implementing a complex 1003 form.


More information about the seaside mailing list