[Seaside] [Scriptaculous] Configure element's class from insidetheupdater?

Lukas Renggli renggli at gmail.com
Tue Jun 27 17:48:38 UTC 2006

> What an excellent trial-and-error exercise this is, I got the darn thing
> folded into one onClick in code, although it does the same thing still :)

Yeah, interesting process. I experienced similar trial-and-error exercises ;-)

> | fid |
> fid := html nextId.
> (html form)
>  id: fid;
>  with:
>   [(html checkbox)
>     value: (self isSelected: row);
>     callback: [:value | self select: row if: value];
>     onClick:
>      ((html evaluator)
>         triggerForm: fid;
>         callback: [:script | ]
>         value: (html element)
>                  id: row webid;
>                  addClassName: 'selected';
>                  yourself);
>         yourself)]

1. Your brackets and semicolons are very strangely placed. I think
they are probably wrong and cause some problems.

2. You don't need "html evaluator" if you don't inject a script into
the web-page, just use "html request" for simple requests.

3. The AJAX objects (request, updater, evaluator, etc.) understand a
set of events, such as #onComplete:, #onFailure:, #onSuccess:, etc. I
would use one of these events (probably #onSuccess:) to change the
class of your element. Maybe write a helper function in JavaScript
that takes the element and the checkbox as parameters and toggles the
classes appropriately. Then you can attach this function to the event

Hope this helps,

Lukas Renggli

More information about the Seaside mailing list