[Seaside] dynamic selection - liveCallback question

Yar Hwee Boon hboon at motionobj.com
Tue Jun 14 11:27:08 CEST 2005


On 14-Jun-05, at PM 04:58, Florian Minjat wrote:

> Does someone have an idea on how to do this?

Try something like:

#renderContentOn: html
	html
		form: [html attributes size: 4.
			html
				selectFromList: #(#a #b #c )
				selected: #a
				callback: [:sel | sel]
				labels: [:ea | ea asString]
				liveCallback: [:sel :h |
					selected := sel.
					self renderToBeUpdatedSectionOn: h]].
	html
		form: [self renderToBeUpdatedSectionOn: html]

#renderToBeUpdatedSectionOn: html
	html
		divNamed: 'toUpdate'
		with: [html attributes size: 4.
			html
				selectFromList: (selected = #a
						ifTrue: [#(#aa #bb #cc )]
						ifFalse: [#(#ba #bb #bc )])
				selected: #aa
				callback: [:sel | sel]
				labels: [:ea | ea asString]]

You don't want to send #renderContentOn: because the point of using 
XMLHttpRequest is to update only a portion of the page (in your case 
the second SELECT). So you wrap the second SELECT in a DIV. And then in 
your callback render the DIV which is to be updated. I remember that 
Firefox crashed on me when I used similar code (try changing the first 
SELECT very fast), I ended up not using it, so if anyone knows what's 
wrong that will be great.

HTH

--
HweeBoon
http://motionobj.com/blog/
MotionObj
(65) 6764-9774



More information about the Seaside mailing list