[Seaside] How would you re-write this code to hide/show content

Mike me at mikehogan.net
Fri Jan 21 23:14:58 CET 2005

Hi all,

I am new to seaside (and smalltalk even).  I wrote a small piece 
of code (pasted below) to show the content one of three DIVs, 
based on a selection from drop down box.  The code makes much use 
of javascript, and little use of the seaside API.  Can anyone 
offer any advice on how to write this the "seaside way"?

Thanks very much,

renderContentOn: html
		script: 'function showDiv(selectBox) {
selection = selectBox.options[selectBox.selectedIndex].text
document.getElementById("div" + selection).style.display="block"
	html attributes at: 'onChange' ifAbsentPut: ['showDiv(this)'].
		selectFromList: #(1 2 3)
		selected: #'1'
		callback: [:v | ].
	html divNamed: 'div1' with: 'div 1 contents'.
	html divNamed: 'div2' with: 'div 2 contents'.
	html divNamed: 'div3' with: 'div 3 contents'

More information about the Seaside mailing list