[Seaside] [Q] callbacks in forms... or data passing

Julian Fitzell julian at beta4.com
Fri Jun 13 11:49:04 CEST 2003


Brian Brown wrote:
> 
> On Thursday, Jun 12, 2003, at 14:57 America/Denver, Julian Fitzell wrote:
> 
>> Brian Brown wrote:
>>
>>> Since in textInputWithValue:callback:, the callback: is a block, does 
>>> this mean that every input on a form could potentially send a 
>>> different message to different receivers?
>>
>>
>> Yes, every text input can do whatever it wants with its new value.
> 
> 
> Okay, so when the client hits the submitButton, how does the (for 
> example) defaultAction get processed. The callbacks on text inputs and 
> other elements aren't part of defaultAction, so when do they get 
> processed? I'm just trying to understand the flow of forms, and how they 
> can relate to components. So far, it's been quite nice, making default 
> selections and what not...

If there is a defaultAction, it is triggered by a hidden field which is 
added to the form.  The text in put callbacks are all triggered first, 
followed by the defaultAction or the action associated with the submit 
button that was pressed.

> 
>>
>>> When updating data in an instance or collecting form information to 
>>> create an instance of a class, would you just use the callbacks to 
>>> set instance variables like in WSMPasswordEditor, or is there some 
>>> other idiom that should be used?
>>
>>
>> If all you want to do is hook up a text field to a instance variable 
>> of an object you can use #textInputOn:of:
>>
> 
> Ok, thanks for the pointer... the other thing I was wondering is if that 
> is a "normal" way of doing things... some set of classes that the 
> Seaside app is providing the front end to, and then adding instance 
> variables to WAComponent subclasses to store form information and then 
> use it with those back end classes.

Well, you don't necessarily want to add instance variables to your 
components.  It really depends on whether you want changes to be 
instantly reflected in your model objects or whether the user is working 
on data in mulitple steps that should only be applied when the user hits 
'Done' or something.  Note, if you give #textInputOn:of: a symbol like 
#foo for the first parameter, it will check for methods #foo and #foo: 
and use those if they exist.  If they don't, then it will look for an 
instvar called foo.

Julian



More information about the Seaside mailing list