[Seaside] JQDialog button problems

Nick Ager nick.ager at gmail.com
Tue Jan 24 11:15:19 UTC 2012


Hi Malte,

I tried modifying the JQDialogFunctionalTest>>#renderOpenWindowOn: to add
an extra button. The relevant modifications are:

html jQuery new dialog
title: 'Vegetables';
autoOpen: false;
addButton: 'Close' do: html jQuery new dialog close;
addButton: 'Ok' do: (html jQuery ajax script: [:s | self halt ])

where you'd substitute the action associated with 'OK' to your
requirements. The dialog sample is viewable from:
http://localhost:8080/javascript/jquery-ui/dialogwidget

I think the JQDialog>>#buttons: comment is misleading as IIUC it should
take a dictionary not an array.

Your code could be modified to something like (untested):

testButtons: html
Dictionary new
    at: 'Annuleer' put: (html jQuery ajax script: [ :h | self actionCancel:
h ]);
        at: 'Ok' put: (html jQuery ajax
          serializeForm: (html jQuery id: self personDataFormId) ;
          script: [ :s | self actionFinish: s ]);
          yourself

Hope this helps

Nick


On 24 January 2012 08:06, Malte Grunwald <malte.grunwald at googlemail.com>wrote:

>  Hey everybody,
>
> I have this problem for a while now and not found a solution until now.
> I already brought this up, a few months ago, some people tried to help me,
> but I did not found a solution.
>
> I will use a JQDialog with multiple buttons, i.e. "cancel" and "confirm".
> The cancel button should only close the window.
> No problem so far.
> But now the tricky part, the "confirm" button should serialize a form,
> send an ajax request to update a div container and then close the window.
>
> My problem is, I am not able to attach more than one method to a button.
>
> Here my example dialog:
>
> *(html div)
>         id: anIdString;
>         script: (((html jQuery id: anIdString) dialog)
>                     title: (anIdString copyFrom: 4 to: anIdString size);
>                     autoOpen: false;
>                     modal: true;
>                     width: anInteger;
>                     height: 'auto';
>                     resizable: false;
>                     addButton: 'Close' do: html jQuery new dialog close);
>         with: [self dialogContent: html]*
>
> This is a suggestion, Jan van de Sandt made. Thanks again.
>
> *testButtons: html*
>  *^ OrderedCollection new*
> * *
> * add: (Dictionary new*
> * at: 'id' put: html nextId ;*
> * at: 'text' put: 'Annuleer' ;*
> * *
> * at: 'click' put: (html jQuery ajax script: [ :h | self actionCancel: h
> ]) asFunction ;*
> * yourself) ;*
> * *
> * add: (Dictionary new*
> * at: 'id' put: html nextId ;*
> * at: 'text' put: 'Ok' ;*
> * *
> * at: 'click' put: (html jQuery ajax *
> * serializeForm: (html jQuery id: self personDataFormId) ;*
> * *
> * script: [ :s | self actionFinish: s ]) asFunction ;*
> * yourself) ;*
> * asArray
>
>
> *
> *(html div)
>         id: anIdString;
>         script: (((html jQuery id: anIdString) dialog)
>                     title: (anIdString copyFrom: 4 to: anIdString size);
>                     autoOpen: false;
>                     modal: true;
>                     width: anInteger;
>                     height: 'auto';
>                     resizable: false;
>                     addButton: 'Close' do: html jQuery new dialog close);
>                     buttons: (self testButtons: html);
>         with: [self dialogContent: html]*
> *
>
> *But this did not work for me.
> Maybe somebody have an idea.
>
> Thank you very much!
>
> Kind regards
>
> Malte
>
>
> _______________________________________________
> 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/20120124/4d61cebd/attachment-0001.htm


More information about the seaside mailing list