[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,
Mike
renderContentOn: html
html
script: 'function showDiv(selectBox) {
document.getElementById("div1").style.display="none"
document.getElementById("div2").style.display="none"
document.getElementById("div3").style.display="none"
selection = selectBox.options[selectBox.selectedIndex].text
document.getElementById("div" + selection).style.display="block"
}'.
html attributes at: 'onChange' ifAbsentPut: ['showDiv(this)'].
html
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