[Seaside] Usage of Canvas' #select and #labels
Rick Flower
rickf at ca-flower.com
Sun Apr 8 07:19:24 UTC 2007
Rick Flower wrote:
> Philippe Marschall wrote:
>> html select
>> beOptional
>> list: orgs;
>> on: #orgId of: self;
>> labels: [:org | org name ];
>> optionalLabel: 'Select One...'.
>>
> Well.. This works fine for regular times when using regular callbacks
> but fails when using a liveCallback (care of SeasideAsync) as the
> index is off by 1.. I'll see about making a fix to do the right thing
> when I'm a bit less tired.. I guess we need to teach it about the use
> of beOptional and friends. Once that is done then it should work ok.
OK -- here's a quick fix to the SeasideAsync version of #liveCallback..
This version fixes the issue but only for single selections -- not
multiples -- I've got no code that uses multiples currently and am not
really sure what modifications need to be done at this point. Perhaps
someone could make the relevant updates for that case? Anyway, below is
the modified code -- feel free to change the logic, but it seems to work
in my case.
liveCallback: liveBlock
| uri id realEach|
id := self ensureId.
liveBlock fixCallbackTemps.
uri := canvas
urlForLiveAction: [:event :h |
| values value |
values := event value asArray collect:
[:each | (self isOptional)
ifTrue: [ realEach := each
asInteger - 1]
ifFalse: [ realEach := each
asInteger].
list at: realEach].
-- Rick
More information about the Seaside
mailing list