[Seaside] How to change callback for html select on the fly
Bob Arning
arning315 at comcast.net
Sun Aug 19 17:13:35 UTC 2012
I think this does what you were looking for. I got stymied for a while
hitting return after changing the value in the text field. This caused a
complete redraw and did not activate the updater callback. If I hit tab
instead of return, things started working. FYI.
Cheers,
Bob
renderContentOnSqueakman1: html
| fid mid saveText |
fid _ html nextId.
mid _ html nextId.
html form
id: fid;
with: [
(html textInput)
value: 'initial';
callback: [:v | saveText _ v];
onChange: ((html scriptaculous updater)
id: mid;
triggerForm: fid;
callback: [:r |
self renderTheListWith: saveText
asArray on: r
]
).
html div
id: mid;
with: [
self renderTheListWith: #(30 50 60) on: html
]
].
renderTheListWith: data on: html
html text: 'Choose Amount'.
html select
callback: [:v | self amount: v];
list: data.
On 8/19/12 10:06 AM, squeakman wrote:
> Greetings List,
>
> I have a form with a text field and an html select with a list of
> choices.
>
> When the user exits the text field (onChange) I want to change the
> list of choices for the dropdown list.
>
> I can get the contents of the dropdown list to change but I cannot
> determine how to change the associated callback.
>
> Is there a way to replace not only the contents of the dropdown list
> but also its callback?
>
> Below is an extract of the code to show what I am trying to do.
>
> Thanks for any help you can provide,
>
> Frank
>
>
> ----- start of code -----
>
> (html textInput)
> callback: [:v | self textValue: v];
> onChange: ((html scriptaculous updater)
> id: #prices;
> triggerForm: fid;
> "Attempt to replace callback"
> callback:
> [:r |
> (r select)
> callback: [:v | self amount: v];
> list: #(15 25)].
>
> " The dropdown list"
> html text: 'Choose Amount'.
> (html select)
> id: #prices;
> callback: [:v | self amount: v];
> list: #(30 50 60).
>
> _______________________________________________
> 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/20120819/cb972f3a/attachment.htm
More information about the seaside
mailing list