Search code examples
smalltalk

Smalltalk new lines?


I can't get this to work at all:

renderContentOn: html
    html form: [
        html textInput
        on: #newEmp of: self.

        html submitButton
        callback: [ self addEmployee: newEmp ];
        text: 'Add Employee'.

        self employeeNames do: [ :eachEmp |  html text: Character cr asString. html text: eachEmp.]
    ]

I just keep getting my output on one line. Am I missing something? I've tried several variations of cr but none have worked thus far.


Solution

  • Don't rely on carriage returns to display your data in the browser. The employee names obviously belong either in a list or a table (you are providing a list of names):

    html unorderedList: [
        self employeeNames do: [ :eachEmp | 
            html listItem: [
                html text: eachEmp ] ] ]