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

Diogenes Moreira diogenes.moreira at gmail.com
Thu Mar 17 02:45:38 UTC 2011


Well I'll guessing this reponse but Im deduce this form html code :)

the deault acction is implemented by a hidden submit input.. <input
type="submit" class="submit" style="position: absolute; top: -100em;"
name="7" value="Default" tabindex="-1">.. in a hidden div or a text input if
your browser is explorer.

In other situation when you press enter the post have your field values and
the variable 7=Default,,, 7 is an id on the fly generated. that value
identify the default block in the WeakDictionary of the session.

When you do submit via jquery the "7" field is'nt setting, because, nothing
happend when you are do submit via Jquery.

For obteing your expecting behiavior i suggest 3 way.

1. Extend WAFormTag for obteing or assing the id for the default action
control, and then do submit
2. Or Implement you own hidden button.
3. Obteing the id and value to defaultAction continuation and set this
variable en your post..

That Solution don't be beatyfull but must work..

Best.



On Wed, Mar 16, 2011 at 7:27 PM, Esteban Lorenzano <estebanlm at gmail.com>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/a081c909/attachment.htm


More information about the seaside mailing list