[Seaside] registerObjectForBacktracking, submit and execute block

Andreas Nilsson wahboh at mac.com
Sun Aug 29 10:34:41 CEST 2004


This is what i'm doing:

records do: [
	html checkboxWithValue: (selection includes: aRecord) callback: [ 
:isSelected |
		isSelected
			ifTrue: [ selection add: aRecord ]
			ifFalse: [ (selection includes: aRecord) ifTrue: [selection remove: 
aRecord] ].
	]
].

html attributes at: 'onClick' put: 'javascript:submit()'.
html anchorWithAction: [self removeRecords] text: 'Remove'.

The checkboxes updates the selection on submit and the block removes 
the selected records.
Both 'records' and 'selection' are registered for backtracking.
 From your actual order it seems that everything is rendered and stored 
before removeRecords executes which would explain the problem.

/Adde

On 2004-08-28, at 23.47, Avi Bryant wrote:

>
> On Aug 28, 2004, at 10:38 AM, Andreas Nilsson wrote:
>
>> I'm trying to build an edit form with a table displaying items, a 
>> checkbox for each item and a link to delete all checked items.
>> In my form i have two collections, one to keep all items and another 
>> one to keep the selection.
>> It all worked flawlessly until i decided to register the collections 
>> for backtracking, now nothing happens when i delete items.
>> The problem as I see it is that the snapshot is taken when the form 
>> submits, before the block is executed that removes the checked items.
>
> I don't understand the problem, but for reference, the actual order is 
> this:
>
> 1) render response
> 2) take snapshot
> 3) accept request
> 4) restore snapshot
> 5) process callbacks (execute blocks)
> 6) back to (1)
>
> Where for any given iteration, 3-5 may actually occur any number of 
> times if the back button is used.
>
> Can you maybe post a minimal test case that shows the faulty behavior?
>
> Cheers,
> Avi
>
>> Current behaviour:
>> 1)	Submit to update selection
>> 2)  	Take snapshot for backtracking
>> 3) 	Execute block removing checked items
>>
>> Correct behaviour:
>> 1)	Submit to update selection
>> 2)	Execute block removing checked items
>> 3)	Take snapshot for backtracking
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/listinfo/seaside



More information about the Seaside mailing list