Arc Forum | | foo | foo ifNil: [html form: [html textInput callback: [:t | foo := t]...

16 points by pc 6501 days ago | link | parent

 | foo |
 foo
 ifNil: [html form: [html textInput callback: [:t | foo := t]]]
 ifNotNil: [html anchor callback: [self inform: 'You said ', foo]; with: 'click here']


4 points by ben 6499 days ago | link

In case anybody is wondering, this is smalltalk and Seaside.

-----

1 point by cwp 6499 days ago | link

Nice idea, but it doesn't work. It should be something like this:

 renderContentOn: html
 said 
 ifNil: 
 [html form: [html textInput callback: [:v | said := v]. 
 html submitButton]]
 ifNotNil:
 [clicked 
 ifNil: [html anchor callback: [clicked := true]; with: 'click here']
 ifNotNil: [html text: 'You said: ', said]].
A more elegant implementation might use the lower levels of Seaside directly, and dispense with components completely. But Arc is about brevity, not elegance, right?

-----

2 points by pc 6499 days ago | link

Well, even that code omits the definition of "said" and "clicked". (The latter is unnecessary as far as I can see.)

I agree that mine isn't precisely by the spec -- you have to press 'enter' to submit the form, and there's an ok button on the last page -- but these are fairly trivial differences in presentation due to the behaviour of the built-in libraries.

(also, minor footnote: I'm assuming that "foo", "said" and "clicked" are instance variables in each example.)

-----




AltStyle によって変換されたページ (->オリジナル) /