[Seaside] Collecting form input
Sebastian Nozzi
sebnozzi at googlemail.com
Wed Oct 8 11:16:11 UTC 2008
Ups, you're right. I misread (was thinking of temporary all the time).
Instance variables... well, that's an idea. Thanks!
2008/10/8 ryan <ryan at intgo.net>:
> Those instance variables, they are temporary variables.
> Instance variables are declared in the class declaration something like.
>
> WAComponent subclass: #addUserForm
> instanceVariableNames: 'newName newSalutation'
> classVariableNames: ''
> poolDictionaries: ''
> category: 'MyProject'
>
> -------------
> renderContentOn: html
> html
> form: [
> html textInput value: 'type name here';
> callback: [:name | newName := name].
> html select list: salutations;
> callback: [:userSalutation| newSalutation := userSalutation ];
> labels: [:userSalutation | userSalutation asString].
> html submitButton
> callback: [self addUserNamed: newName withSalutation: newSalutation];
> value: 'Add New User']
>
> Should work fine.
> You might be interested in looking at using something like Ramon Leon's
> SSForms available in his image that you can download from his blog (http://onsmalltalk.com/)
> or Magritte to help you build forms complete with validation.
>
>
> On Wed, 2008-10-08 at 10:28 +0200, Sebastian Nozzi wrote:
>> Hi Phillipe,
>>
>> thanks for your reply.
>>
>> > You could also use ValueHolders but that gets quite ugly. I'd use
>> > instance variables and split it up.
>>
>> I'll look into ValueHolders (never heard of them; but I'm a newbie... so...)
>>
>> What do you mean by the latter? Because it was with instance variables
>> that I first tried, but as I said it didn't work:
>>
>> | newName newSalutation |
>> html
>> form: [html textInput value: 'type name here';
>> callback: [:name | newName := name].
>> html select list: salutations;
>> callback: [:userSalutation| newSalutation :=
>> userSalutation ];
>> labels: [:userSalutation | userSalutation asString].
>> html submitButton
>> callback: [self addUserNamed: newName
>> withSalutation: newSalutation];
>> value: 'Add New User']
>>
>> When the callback in the submitButton was called, "newName" and
>> "newSalutation" were nil.
>>
>> What I was trying to do is to avoid creating a temporary user
>> instance, and only create it when the user submits the data (the user
>> could instead opt to go back).
>>
>> But I think I might be overcomplicating things and I might just create
>> the temporary instance, since I'm creating a Dictionary anyway...
>>
>> Greetings,
>>
>> Sebastian
>> _______________________________________________
>> seaside mailing list
>> seaside at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
More information about the seaside
mailing list