[Seaside] Checkbox trouble with converting to canvas API

Philippe Marschall philippe.marschall at gmail.com
Sat Oct 28 06:35:24 UTC 2006

2006/10/27, Carl Gundel <carlg at libertybasic.com>:
> I'm converting my application over to the new canvas API.  It's going
> reasonable well, but for some reason I cannot get the checkbox in the
> example below to invoke its callback when the form is submitted.  I had no
> trouble with this using the original API.  I've tried a bunch of things to
> no avail.  Any ideas why this might not be working?
> renderContentOn: html
>     self hideCodeEditor ifTrue: [^self].
>     (html div) id: #activeStuff;
>         with:
>             [html form with:
>                 [(html textArea) rows: 15; columns: 80; text: self code;
>                     callback: [:v | self code: v].
>                 html tag: 'br'.
>                 (html anchor) text: 'Run';
>                     callback: [self run]; submitFormNamed: #activeStuff.
>                 (html checkbox) value: self hideCodeEditor;
>                     callback: [:v| self hideCodeEditor: v].
>                 html text: 'Hide code editor on Run']]

Where to start?
- there is no form with id #activeStuff only a div
- #with: has always to be the last message, anchor #text: is an alias
for #with: so it has to be last message as well.
- forms should be submitted by submit buttons, that's what they are
there for. If You don't like their appearance, use CSS.
- you can make use of #on:of: for form elements.

Try something like this

renderContentOn: html
	html div
		id: #activeStuff;
		with: [
		html form: [
			html textArea
				rows: 15; columns: 80;
				on: #code of: self.
			html break.
			html submitButton
				callback: [ self run ];
				text: 'Run'.
			html checkbox
				on: #hideCodeEditor of: self.
			html text: 'Hide code editor on Run' ] ]

Forms are one of the suckiest parts of HTML. Seaside can't hide that.


More information about the Seaside mailing list