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 [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
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 <[hidden email]> wrote:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
I've added an issue: http://code.google.com/p/seaside/issues/detail?id=708 _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Malte Grunwald
You can chain in jQuery. Otherwise, I'm a big fan of doing an ajax request and passing a function to the #onSuccess: event of it. For example:
(this code isn't tested, so I may make a couple mistakes) ... #addButton: ( (html jQuery ajax script: [:s | s add: (self thisFunctionDoesSomethingServersideAndUpdatesADivOn: s) ] ) onSuccess: ( html jQuery new dialog close ) ). ... Hope that helps, RS Date: Tue, 24 Jan 2012 09:06:49 +0100 From: [hidden email] To: [hidden email] Subject: [Seaside] JQDialog button problems 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 [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 |
Hello,
i tried it with the hints, you gave me and it works! Thank you guys so much! Regards Malte Am 24.01.2012 15:43, schrieb Robert Sirois:
_______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |