[Seaside] Google-Gmail 'Attach a file' Component

Patrick Collison patrick at collison.ie
Tue Aug 7 14:20:52 UTC 2007

On 07/08/07, dirk newbold <dirkdirk at gmail.com> wrote:
> All,
> Newbie Question:
> I'm trying to mimic the Google-Gmail 'Attach a file' Component (the
> one used in their 'Compose Mail' facility, situated under the
> 'Subject' with the paperclip icon) instead of using the more
> cumbersome looking html fileUpload & html submitButton.
> Could this be developed into a standard Seaside Component?
> Also I'm looking for some more detailed explanation of how the
> Scriptaculous's onChange/onClick callback method works i.e. in the
> code below I understand how the first callback works but I am a bit
> lost as to the ins and outs of the second callback.
> html select
>    list: (1 to: 9);
>    selected: selectList;
>    callback: [ :value | selectList := value ];
>    onChange: (html updater
>       id: mid;
>       triggerForm: fid;
>       callback: [ :r | r render: selectList ])
> Any help/explanation would be great.

The argument to the second callback is an HTML canvas (like the one
supplied to any #renderContentOn: method), and the callback is
executed asynchronously whenever the item selected changes. Whatever
html is generated will be used to update the contents of whatever
element in the page has an id matching that referred to by the mid

As a simple example, try:

html div
    id: 'foo';
    with: [
        html anchor
            onClick: (html updater id: 'foo'; callback: [:h | h text:
            with: 'Click me']

More information about the Seaside mailing list