[Seaside] Submiting a form with a confirmation dialog (jquery) does not work properly

Sebastian Sastre sebastian at flowingconcept.com
Wed Mar 16 22:49:30 UTC 2011


did you tried:

thatSubmitButton.click()

?

sebastian

o/




On Mar 16, 2011, at 7:27 PM, Esteban Lorenzano wrote:

> Hi, 
> I'm trying to add a "confirmation dialog" using jQuery in a form, and calling submit from a jquery statement is not working properly (or at least, is not working as I was hoping to work). If I submit the form using javascript, I was expecting #defaultAction: to be called, but no :( 
> 
> Does anybody knows how can I do this properly? 
> 
> In the example, I render a dialog (with a form), then a form, and the "accept" button opens the dialog. The accept button in the dialog triggers my confirmation dialog and on complete submits the original form. 
> 
> This is the code: 
> 
> renderDialogCollectExtraInfoOn: html
> 	| dialogId formId dialogFormId |
> 
> 	dialogId := html nextId.
> 	dialogFormId := html nextId.	 
> 	formId := html nextId.
> 	
> 	html heading 
> 		level2;
> 		with: 'Collect extra information in confirmation dialog'.
> 	
> 	html div
> 		id: dialogId;  
> 		script: (html jQuery this dialog
> 			title: 'Dialog with extra info';
> 			resizable: false;
> 			modal: true;
> 			autoOpen: false;
> 			addButton: 'Accept' do: (html jQuery ajax 
> 				serializeForm: (html jQuery id: dialogFormId);
> 				onComplete: ((html jQuery id: formId) call: 'submit'));
> 			addButton: 'Cancel' do: (html jQuery this dialog close));
> 		with: [
> 			html form
> 				id: dialogFormId;
> 				with: [ 
> 					html checkbox 
> 						on: #confirm1 of: self;
> 						with: 'Confirm 1' ] ].
> 	
> 	html form
> 		id: formId;
> 		defaultAction: [ self halt. self inform: 'Ok'. "I'm expecting this to be executed" ];
> 		with: [		
> 			html text: 'Some text: '.
> 			html textInput on: #text of: self.
> 
> 			html button 
> 				onClick: (html javascript
> 					add: ((html jQuery id: dialogId) dialog open);
> 					add: (JSStream on: 'return false');
> 					yourself);
> 				callback: [ self halt. "I'm not expecting this to be executed" ];
> 				with: 'Accept' ] 
> 
> Thanks, 
> Esteban_______________________________________________
> 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/20110316/961e2e63/attachment-0001.htm


More information about the seaside mailing list