[Seaside] Seaside updater
Gerhard Obermann
obi068 at gmail.com
Sat Mar 8 18:34:07 UTC 2008
Hi!
I made a quick and dirty example!
HTH
Gerhard
| formId |
formId := html nextId.
html form id: formId;
with: [html checkbox value: false; callback: [:v | set := v];
onClick: (html evaluator triggerForm: formId;
callback: [:script | script element id: 'text';
update: [:r | set ifTrue: [r text: 'My address']
ifFalse: [r text: '']] ]).
html textArea id: 'text'; with: [html text: 'Empty']].
On Sat, Mar 8, 2008 at 4:38 PM, Richard K Eng <richard.eng at rogers.com>
wrote:
> I'm puzzled how to use #updater. I'm trying to use a checkbox to add text
> to
> a textArea input field. For example,...
>
> renderBillingCheckboxAndAddressOn: html
> html div
> class: 'frow';
> with:
> [html break.
> html paragraph:
> [html checkbox
> value: useShippingAddress;
> callback: [:value | useShippingAddress := value];
> onClick: (html updater id: 'shipping';
> callback: [:r | useShippingAddress := useShippingAddress not.
> self renderBillingAddressOn: r] );
> with: 'Use shipping address as billing address also']].
> html div
> class: 'frow';
> with:
> [html span
> class: 'formlabel';
> with: [html text: 'Billing address'].
> html span
> class: 'forminput';
> with: [self renderBillingAddressOn: html]]
>
>
> This code works, but I'm sure it's not the right way to do things. The
> reason I have the 'useShippingAddress := useShippingAddress not' nonsense
> is
> because without it, I can't get #useShippingAddress to have the correct
> checkbox value in #renderBillingAddressOn:. The problem is,
> #useShippingAddress only gets the correct checkbox value on form
> submission,
> NOT upon invocation of #onClick:.
>
> Ultimately, what I want is for #onClick: to use whatever value is selected
> by the form control, whether the control is a checkbox or radio button or
> dropdown menu. This *has* to be doable, so the question is: HOW???
>
> Regards,
> Richard
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080308/3b030eb8/attachment.htm
More information about the seaside
mailing list