[Seaside] Bug report in Live update

Michel Bany m.bany at wanadoo.fr
Mon Oct 4 21:52:15 CEST 2004


I spotted a weird bug in the live update feature for <select>.

In method #selectFromList:selected:callback:labels:liveCallback: the 
collection
in the first argument is expected to be indexed.
However, if the collection supplied by the sender is not indexed, the 
situation is hardly debugable.
It took me a couple of hours to spot it.
You will be able to see the effect for yourself if you change the test 
case WALiveRequestTest and
supply #(a b c) asSet rather than #(a b c) for the collection.

I suggest #selectFromList:selected:callback:labels:liveCallback: is 
changed to turn the collection into
an array before using its contents. With this change, future users of 
this feature will not waste their time
should they supply a non-indexed collection.

selectFromList: aCollection selected: anObject callback: callbackBlock 
labels: labelsBlock liveCallback: liveBlock
    | uri id items |
    items := aCollection asArray.
    id := self ensureId.
    self selectFromList: items selected: anObject callback: 
callbackBlock labels: labelsBlock.
    uri := self urlForLiveRequest: [:index :h | liveBlock value: (items 
at: index asInteger + 1 ifAbsent: []) value: h].
    self script: 'document.getElementById(',id printString,').onchange = 
liveSelect(',id printString,',',uri asString printString,')'



Enjoy,
Michel.



More information about the Seaside mailing list