[Seaside] Forms - Select List: action before submit button

Cédrick Béler cbeler at enit.fr
Tue Jun 12 08:42:30 UTC 2007

dirk newbold a écrit :
> All,
> http://ajax.asp.net/ajaxtoolkit/CascadingDropDown/CascadingDropDown.aspx
> I found the exact example I am trying to achieve as per this ajax link 
> above.
> I'm guessing Seaside has same deal but can't see to make anything work 
> - I'm new at all this.
> Thanks,
> Dirk
I think you have to use the updater and onChange() event to realize 
that... in 3 different select...
have a look at SUClassBrowser renderCategoriesOn: html...   or see 
implementors of #updater
Also, there was a similar stuuf with SeasideAsync but if you use only 
scriptaculous, this should be somethink like (not tested):

renderContentOn: html
html div
    id: 'box1';
    with: [self renderBox1On: html].
html div
    id: 'box2';
    with: [self renderBox2On: html].
html div
    id: 'box1';
    with: [self renderBox3On: html].

renderBox1On: html
    html select
        id: 'box1';
        selected: self val1;
        list: self list1;
        callback: [:valBox1 | self val1 := valBox1]
        onChange: (hmtl updater
                            id: 'box2';    "on change,   update the box 
named box2"
                            triggerFormElement: 'box1'   "also triger 
the action associated to that form element.... self val1 := valBox1   
ort whaterver..."
                            callback: [:render | self renderBox2On: 
render].   " the box is redrawn with the rendering fonction renderBox3"
                            onSuccess: (html updater   "don't forget to 
upadate the last box..."
                                    id: 'box3';
                                   callback: [:render | self 
renderBox3On: render])  

renderBox2On: html
    html select
        id: 'box2';
        selected: self val2;
        list: self list2;
        callback: [:valBox2 | self val2 := valBox2]
        onChange: (hmtl updater
                            id: 'box2';
                            triggerFormElement: 'box2';
                            callback: [:render | self renderBox3On: render]

renderBox3On: html
    html select
        id: 'box3';
        selected: self val3;
        list: self list3;
        callback: [:valBox3 | self val3 := valBox3]
        onChange: (hmtl request
                            triggerFormElement: 'box2']  "only trigger 
the callback associated to id box3... no rendering needed..."



More information about the Seaside mailing list