OnClick on an "html select" not working for me in Seaside 3.0

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

OnClick on an "html select" not working for me in Seaside 3.0

squeakman
Greetings,

I am attempting to display a list and trigger a callback onClick when
the user clicks on an item in the list.

The list is displayed correctly and when the user clicks an item I get a
debugger saying:

'This block expects 0 argument(s) but is invoked with 1 argument(s)'

I had similar code to this working in Seaside 2.8 but it is failing in
Seaside 3.0.

renderContentOn: html
     | listToDisplay |

     listToDisplay := OrderedCollection new.
     listToDisplay add: 'AAPL'; add: 'INTC'; add: 'GOOG'.

     (html div)
         id: 'passedPanel';
         with:
                 [(html div)
                     id: 'passed';
                     with:
                           [(html select)
                             id: 'passedList';
                             list: listToDisplay;
                             selected: (listToDisplay at: 1);
                             onClick: ((html scriptaculous updater)
                                       id: 'foo';
                                       triggerFormElement: 'passedList';
                                       callback: [self openStock])].

          "this div is a dummy div for the click  to work    - its
a kludge"
                         html div id: 'foo'.
                 ]

Any help would be appreciated.

Thanks,
Frank

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: OnClick on an "html select" not working for me in Seaside 3.0

Jon Paynter-2
This looks similar to some strangeness I saw.
try putting the script first in your cascade like so:

(html select)
     id: 'passedList';
     onClick: ((html scriptaculous updater)
          id: 'foo';
          triggerFormElement: 'passedList';
          callback: [self openStock]);
     list: listToDisplay;
     selected: (listToDisplay at: 1).

On Sun, Sep 11, 2011 at 5:50 PM, Squeaker <[hidden email]> wrote:
Greetings,

I am attempting to display a list and trigger a callback onClick when the user clicks on an item in the list.

The list is displayed correctly and when the user clicks an item I get a debugger saying:

'This block expects 0 argument(s) but is invoked with 1 argument(s)'

I had similar code to this working in Seaside 2.8 but it is failing in Seaside 3.0.

renderContentOn: html
   | listToDisplay |

   listToDisplay := OrderedCollection new.
   listToDisplay add: 'AAPL'; add: 'INTC'; add: 'GOOG'.

   (html div)
       id: 'passedPanel';
       with:
               [(html div)
                   id: 'passed';
                   with:
                         [(html select)
                           id: 'passedList';
                           list: listToDisplay;
                           selected: (listToDisplay at: 1);
                           onClick: ((html scriptaculous updater)
                                     id: 'foo';
                                     triggerFormElement: 'passedList';
                                     callback: [self openStock])].

                       "this div is a dummy div for the click  to work                           - its a kludge"
                       html div id: 'foo'.
               ]

Any help would be appreciated.

Thanks,
Frank

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: OnClick on an "html select" not working for me in Seaside 3.0

squeakman
On 12/09/2011 2:35 AM, Jon Paynter wrote:

> This looks similar to some strangeness I saw.
> try putting the script first in your cascade like so:
>
> (html select)
>       id: 'passedList';
> onClick: ((html scriptaculous updater)
> id: 'foo';
> triggerFormElement: 'passedList';
> callback: [self openStock]);
> list: listToDisplay;
> selected: (listToDisplay at: 1).
>

I tried your suggestion to no avail but I did fix the problem. When I
looked more carefully at the error message I realized what it was
complaining about.  The fix is to add an arg to the callback block.

  callback: [:r | self openStock]);

I am pretty sure that in Seaside 2.8 the callback worked as a zero parm
block.

Thanks for you help, it got me on the right path.

Frank

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside