[Seaside] Which class best suits a simple submission form?
Samuel Tesla
samuel at alieniloquent.com
Thu Nov 20 06:57:13 CET 2003
Avi Bryant <avi at beta4.com> writes:
> MyWizardTask>>go
> |name address billingAddress creditCardInfo|
> name := self call: (GetNameStep new).
> address := self call: (GetAddressStep new message: 'Shipping
> address').
> address useForBilling
> ifTrue: [billingAddress := address]
> ifFalse: [billingAddress := self call: (GetAddressStep new
> message: 'Billing address')].
> creditCardInfo := self call: (GetCCStep new).
> "... now do something with all of this... "
This worked beautifully! Of course all I can do with the models at
the moment is inspect it in the browser...but hey, that's progress! :)
> Now, this doesn't provide a "Previous" button, but the browser back
> button works fine. For Cancel, I would wrap embed this task in
> another component that provided a permanent cancel button:
>
> CancelWrapper>>initialize
> task := MyWizardTask new.
>
> CancelWrapper>>renderContentOn: html
> html render: task.
> html form: [html submitButtonWithAction: [self answer] text:
> 'Cancel'].
That would work, but in the same vein as using the back button, why
not just have them close the browser window? I think that one of the
coolest features of seaside is that it gives real meaning to the
browser buttons in a web app. It just rocks my world.
> I'm not sure about Finish, I guess it depends how you want that to
> work (what does it mean to Finish before all the info is entered?).
Yeah, don't really need that for my purpose. But one might make a
wizard with multiple exit points.
> The great thing to appreciate about this approach is that you can
> often use the same components in various permutations in different #go
> methods to make different wizards (I tried to suggest this somewhat by
> using the same parameterized component for the the two address steps).
Yeah, I wrote a lot of little components and assembled them into the
actual forms. Works out rather well, I say.
Thanks a lot!
-- Samuel
More information about the Seaside
mailing list