Dynamic Combobox

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic Combobox

Andres Fortier-2
Hi list,
        I started to play around with Seaside yesterday to create a small site
and I must say I'm amazed by the framework; so the first thing I have to
say is congratulations for the excellent work you've done and thanks for
putting it available to the comunity.

Now, regarding the site I must build, so far I've managed to create it,
build some forms, define tasks and so forth. Now I need to perform some
dynamic changes in the page depending on the user selection, so I loaded
the scriptaculous extension. Now, I'm kind of lost in how to change a
form control contents. The situation is this: there are 3 options that
the user can select and I want to give the user the chance to indicate
his preference order. The form looks like:

First choice: <Combobox 1>
Second choice: <Combobox 2>

So, I would like that <Combobox 1> display the three choices and that
<Combobox 2> only contains the other two available choices. Each time
the user selects a new choice in <Combobox 1>, <Combobox 2> should be
updated to reflect this.

I know that I can get the change event by using

        html select
                ...
                onChange: (html updater...

but I couldn't find a way to change <Combobox 2> contents.

Any hints would be really appreciated.

Thanks,
         Andrés

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Combobox

Andrius Paulavicius
Well, Combobox2 rendering should depend on some state which is set in
Combobox1s callback:

html select
    ...
    callback: [:a | self updateCombobox2State: a];
    onChange: (html updater
        id: combobox2Id;
        callback: [:render | self renderCombobox2: render]).

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Combobox

Andres Fortier-2
Thanks for the quick response! I wasn't aware that

        callback: [:render | self renderCombobox2: render]

would force the refresh of the combo contents. I'll try right away.

Thanks again,
              Andrés

Andrius Paulavicius escribió:

> Well, Combobox2 rendering should depend on some state which is set in
> Combobox1s callback:
>
> html select
>     ...
>     callback: [:a | self updateCombobox2State: a];
>     onChange: (html updater
>         id: combobox2Id;
>         callback: [:render | self renderCombobox2: render]).
>
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Combobox

Lukas Renggli
> Thanks for the quick response! I wasn't aware that
>
>         callback: [:render | self renderCombobox2: render]
>
> would force the refresh of the combo contents. I'll try right away.
>
> Thanks again,
>               Andrés
>
> Andrius Paulavicius escribió:
> > Well, Combobox2 rendering should depend on some state which is set in
> > Combobox1s callback:
> >
> > html select
> >     ...
> >     callback: [:a | self updateCombobox2State: a];
> >     onChange: (html updater
> >         id: combobox2Id;
> >         callback: [:render | self renderCombobox2: render]).
> >
> >

You could also check out some ready made components that ship with
Scriptaculous, for example SUBrowser and SUTieredList (has an example
on the class side).

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Combobox

Andres Fortier-2
Thanks Adrius and Lukas, it works like a charm (at least the combo stuff :))

Thanks again,
              Andrés

Lukas Renggli escribió:

>> Thanks for the quick response! I wasn't aware that
>>
>>         callback: [:render | self renderCombobox2: render]
>>
>> would force the refresh of the combo contents. I'll try right away.
>>
>> Thanks again,
>>               Andrés
>>
>> Andrius Paulavicius escribió:
>>> Well, Combobox2 rendering should depend on some state which is set in
>>> Combobox1s callback:
>>>
>>> html select
>>>     ...
>>>     callback: [:a | self updateCombobox2State: a];
>>>     onChange: (html updater
>>>         id: combobox2Id;
>>>         callback: [:render | self renderCombobox2: render]).
>>>
>>>
>
> You could also check out some ready made components that ship with
> Scriptaculous, for example SUBrowser and SUTieredList (has an example
> on the class side).
>
> Cheers,
> Lukas
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside