[Seaside] Help with updating forms the AJAX way...

Brian Brown rbb at techgame.net
Wed Oct 3 23:18:32 UTC 2007


Ok, I got through most of this by obeying a few simple things....

I refactored how my render methods relate to the divs I want to  
update: for the method #renderButtonsOn: I would have div called  
'actionButtons'. As long as I initially set it up as:

renderContentOn: html

html div id: 'actionButtons' with: [self renderButtonsOn: html].
...


then I can do things like
	html evaluator
		callback: [:s | s id: 'actionButtons'; render: [:r | self  
renderButtonsOn: r].
		....

and it works fine. I had things composed so that #renderButtonsOn:  
would look like:

renderButtonsOn: html
	html div id: 'actionButtons';
		with: [html button....]


Trying to update the 'actionButtons' div by calling #renderButtonsOn:  
just doesn't work to well in that case.

I hope this made sense... am I now thinking about this correctly?


Cheers,

Brian

On Sep 26, 2007, at 5:03 PM, Brian Brown wrote:

> Hey guys,
>
> 	Here is the scenario:
>
> I have a component, let's call it ContentEditor, and has a div  
> ContentEditorDiv. Inside are two other divs; TreeDiv and  
> ItemEditorDiv.
>
> Tree has a tree component and when an item is clicked on, an  
> instance of ItemEditor is rendered to, um, edit that item.
>
> What I would LIKE to do, is submit the form in ItemEditor via ajax,  
> also capturing onBlur events so that if someone changes a textInput  
> and tabs to another field, that textInput is saved to the Item in  
> question.
>
> That by itself works fine, but then I also want to re-render the  
> tree with updated text. I thought the easiest way would be to:
>
> html updater
> 	id: 'ContentEditorDiv';
> 	triggerFormNamed: 'ItemEditorForm';
> 	callback: [:r | r render: aContentEditor]
>
> which would tell the whole ContentEditorDiv to re-render. The form  
> submits, but the tree never changes. I've tried rendering the Tree  
> itself, but it never changes either.
>
> I've gone through various permutations of updater and evaluator,  
> and now don't really remember what I did, but I've never been  
> successful in getting the Tree to change when the form in  
> ItemEditor is submitted.
>
> I'd be grateful for some help!
>
>
> Thanks,
>
> Brian
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list