There are several (Seaside related) problems with your code:
I have built a component called
"VeComponent", with an embedded
Magritte component. The code for rendering looks like:
VeComponent>>renderContentOn: html
html render: self model asComponent addValidatedForm; yourself.
html submitButton callback: [self answer: someValue];
text: 'Done'
This instantiates a new component every-time the page is refreshed.
You have to initialize the component outside the rendering method, for
example when assigning the model to your component:
VeComponent>>model: aModel
model := aModel.
component := aModel asComponent addValidatedForm; yourself
VeComponent>>renderContentOn: html
html render: component.
html submitButton
callback: [self answer: someValue];
text: 'Done'
Furthermore you have to answer the component as a child:
VeComponent>>children
^ Array with: component
If I embed aVeComponent in another component then it
appears that the
"self answer: someValue" in VeComponent>>renderContentOn: does not
work.
Initialize your component so that it passes the answer event to the
outer component:
component := aModel asComponent
addValidatedForm;
onAnswer: [ :value | self answer: value ];
yourself
What I observe is that clicking on the 'Done'
button results in the
re-displaying of aVeComponent.
That's the standard if no answer handler is defined.
Also note that a task runs as a loop. So when the go method finishes,
it is automatically restarted.
Cheers,
Lukas
--
Lukas Renggli
http://www.lukas-renggli.ch