[Seaside] Executing form callbacks within a block

Esteban Maringolo emaringolo at gmail.com
Thu May 20 14:03:45 UTC 2021


Hi Karsten,

I'm not using VW in this case, I'm using Pharo.

I understand the use case of BufferedValueHolders, in Magritte the
MAMemento plays a similar role (but without using ValueModels), but
I'm not using either of these, and I'd favor using the MAMemento in
this particular case (I already have the descriptions in place).

My question was more specific about whether there were such "hooks" or
context for all the callbacks belonging to a form.

Thanks for your reply!

Esteban A. Maringolo

On Thu, May 20, 2021 at 2:38 AM Karsten Kusche <karsten at heeg.de> wrote:
>
> Hi Esteban,
>
> i think you’re using VisualWorks, so BufferedValueHolders may be an option here. In a normal VisualWorks ApplicationModel you’d define each input’s aspect with an additional trigger like so: "name | trigger“ or „age | trigger“. The UIBuilder would then create BufferedValueHolders around the ValueModels for name and age. The #trigger is another ValueHolder that you control with your submit/cancel buttons: trigger value: true for submit and trigger value: false for cancel.
> All the trigger really does is submit the values to their actual ValueModels (on submit) or discard the changes on cancel. But in your case it would allow you to control the moment when the values are really submitted.
>
> ValueModels is something Seaside never really considered, there the getter/setter approach is preferred. But we use it in SeaBreeze pretty successfully. Especially because ValueHolders are used in VisualWorks UIs to communicate Changes back to the UI, which is super useful in Seaside, when you can have automatic Updates on the Website without a need to manually refresh the related elements.
>
> If not with ValueModels i’d still solve your problem not on a Seaside level but rather on some other abstraction level. Whatever „self“ is in your example, maybe you should consider getting/setting the values form someone else and have this object take care of the transaction stuff upon submit.
>
> Kind Regards
> Karsten
>
>>
> Georg Heeg eK
>
> Wallstraße 22
> 06366 Köthen
>
> Tel.: 03496/214328
> FAX: 03496/214712
> Amtsgericht Dortmund HRA 12812
>
>
>
> Am 20. Mai 2021 um 03:19:14, Esteban Maringolo (emaringolo at gmail.com) schrieb:
>
> Hi all,
>
> I have a situation where I want to execute _ALL_ the callbacks of the
> inputs in the form within a particular block (basically, a DB
> transaction).
>
> html form: [
> html textInput on: #name of: self.
> html textInput on: #age of: self.
> html submitButton
> ]
>
> I want to execute the three callbacks within something else, or at
> least have the option to execute something before the first callback
> executes and ensure something gets executed after the last one is
> executed.
>
> I know it involves fiddling somehow with
> WACallbackProcessingActionContinuation, but it's not fully clear if I
> could do this.
>
> The hacky alternative would be to have a hidden field that does start
> the tx and the submit / cancel commits or cancels it.
>
> html form: [
> html hiddenInput callback: [self beginTransaction].
> html textInput on: #name of: self.
> html textInput on: #age of: self.
> html submitButton
> callback: [self commitTransaction];
> value: 'Submit'.
> ]
>
> But in this case I'd have to keep the tx "outside" of the form, and
> I'd like to wrap everything in a single block.
>
> Is there a way to do this with Seaside?
>
> Thanks!
>
> Esteban A. Maringolo
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


More information about the seaside mailing list