[Seaside] Newbie problem with Seaside

Avi Bryant avi at beta4.com
Wed Mar 3 21:58:51 CET 2004


On Mar 3, 2004, at 12:50 PM, Vincent wrote:

> Hi, I made a small crossword helper program with Seaside
> (http://darkhost.mine.nu:9090/seaside/crossword/).  I am french, and I
> thought it would be nice to give users the possibility of choosing
> either a french or an english dictionary.
>
> Now, I am not sure how to proceed about this, I want to have a page
> where the user clicks on a SubmitButton to choose the language he wants
> and then have the main program (linked above) show up and use the 
> chosen
> dictionary.
>
> How would I go about it?

I would do it something like this.  Have a component named 
DictionaryChoice with methods #french and #english that return the 
appropiate dictionary objects (I don't know how you're building them so 
I won't show the implementation).  Then its renderContentOn: shows the 
user two buttons and answers the appropriate dictionary:

renderContentOn: html
   html form: [
     html submitButtonWithAction: [self answer: self english] text: 
'English'.
     html space.
     html submitButtonWithAction: [self answer: self french] text: 
'French'.

Then set up a subclass of WATask named CrosswordTask whose #go method 
looks like this:

go
   dict := self call: (DictionaryChoice withMessage: 'Choose a 
language:').
   self call: (CrosswordHelper new dictionary: dict).

Of course I don't know what your current component is called or if it 
has a #dictionary: setter, but you can hopefully adapt this to fit.

CrosswordTask should then be the entry point for your application.



More information about the Seaside mailing list