[Seaside] Re: I have a possible solution to the puzzle at end of Chapter 12.2

Fritz Schenk intrader.intrader at gmail.com
Fri Jun 17 03:16:44 UTC 2011


Fritz Schenk <intrader.intrader <at> gmail.com> writes:

> 
> Lukas Renggli <renggli <at> gmail.com> writes:
> 
> > Hard to tell from the context given (The code looks suspicious to
> > assign multiple onAnswer: handler). The cancel button works fine as
> > long as the form is not submitted multiple times, such as for
> > validation. The easiest and most stable solution is to edit a copy of
> > the contact and to replace it in the collection on success.
> >
Here is the code to edit a copy and then replace it in the collection.
<code>
editContact: aContact
	"overides - comment stating purpose of message"
	
	| copy contacts|
	contacts:= MyContact contacts.
	copy := aContact copy.
	(editor contact: copy) onAnswer: [ :answer |
		"copy has been updated"
		answer ifTrue: [contacts at: (contacts indexOf: aContact) 
put: copy
			] 
 ]
</code>




More information about the seaside mailing list