The dialog is not displayed immediatelly

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

The dialog is not displayed immediatelly

James Gu
Hi,

I am using a dialog to display a processing image before submission because sometimes the submission takes long time.

What I want is:
1. Display the dialog
2. do submission
3. close dialog when submission done.
But actually the dialog is displayed after submission. I am not sure why. Any suggestion will be appreciated.

        <xforms:submission id="get-submission"
                           ref="instance('request')"
                           replace="instance"
                           instance="result"
                           method="post"
                           action="/test">
            <xforms:action ev:event="xforms-submit">
                <xxforms:show dialog="processing-dialog"/>
            </xforms:action>-
            <xforms:action ev:event="xforms-submit-done">
               
            </xforms:action>
        </xforms:submission>

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: The dialog is not displayed immediatelly

Tom Grahame
Hi,

I am trying to do almost exactly the same thing - use a dialog to display feedback to the user during a long submission.

I am trying this:

<xxforms:dialog id="feedback">
        <xforms:action ev:event="xxforms-dialog-open">
                <xforms:insert context="instance('results')" origin="xxforms:call-xpl..."/>
        </xforms:action>
</xxforms:dialog>

According to the logs xxforms-dialog-open is dispatched before the insert occurs, yet the dialog does not appear until after the xpl has completed.

Thanks,

Tom

JamesGu wrote
Hi,

I am using a dialog to display a processing image before submission because sometimes the submission takes long time.

What I want is:
1. Display the dialog
2. do submission
3. close dialog when submission done.
But actually the dialog is displayed after submission. I am not sure why. Any suggestion will be appreciated.

        <xforms:submission id="get-submission"
                           ref="instance('request')"
                           replace="instance"
                           instance="result"
                           method="post"
                           action="/test">
            <xforms:action ev:event="xforms-submit">
                <xxforms:show dialog="processing-dialog"/>
            </xforms:action>-
            <xforms:action ev:event="xforms-submit-done">
               
            </xforms:action>
        </xforms:submission>

Thanks,
James
Reply | Threaded
Open this post in threaded view
|

Re: Re: The dialog is not displayed immediatelly

Erik Bruchez
Administrator
Tom,

That won't work as is, because the dialog won't show before the Ajax
request sent to the server comes back, which happens after the
submission completes.

To support such scenarios we would some kind of continuations
mechanism, which we don't have yet.

You can work around this by forcing back and forths between the client
and the server, e.g.:

* Server opens dialog and runs xxforms:script which dispatches custom event
* Client shows dialog and sends back custom event to server
* Server receives custom event and starts submission
* When submission completes you can close the dialog

Note that we also have xforms:trigger/@xxforms:modal="true" which
shows a built-in waiting screen. That might work for you and be
simpler.

-Erik

On Thu, Jul 30, 2009 at 5:53 AM, Tom
Grahame<[hidden email]> wrote:

>
> Hi,
>
> I am trying to do almost exactly the same thing - use a dialog to display
> feedback to the user during a long submission.
>
> I am trying this:
>
> <xxforms:dialog id="feedback">
>        <xforms:action ev:event="xxforms-dialog-open">
>                <xforms:insert context="instance('results')"
> origin="xxforms:call-xpl..."/>
>        </xforms:action>
> </xxforms:dialog>
>
> According to the logs xxforms-dialog-open is dispatched before the insert
> occurs, yet the dialog does not appear until after the xpl has completed.
>
> Thanks,
>
> Tom
>
>
> JamesGu wrote:
>>
>> Hi,
>>
>> I am using a dialog to display a processing image before submission
>> because sometimes the submission takes long time.
>>
>> What I want is:
>> 1. Display the dialog
>> 2. do submission
>> 3. close dialog when submission done.
>> But actually the dialog is displayed after submission. I am not sure why.
>> Any suggestion will be appreciated.
>>
>>         <xforms:submission id="get-submission"
>>                            ref="instance('request')"
>>                            replace="instance"
>>                            instance="result"
>>                            method="post"
>>                            action="/test">
>>             <xforms:action ev:event="xforms-submit">
>>                 <xxforms:show dialog="processing-dialog"/>
>>             </xforms:action>-
>>             <xforms:action ev:event="xforms-submit-done">
>>                 <!--<xxforms:hide dialog="processing-dialog"/>-->
>>             </xforms:action>
>>         </xforms:submission>
>>
>> Thanks,
>> James
>>
>
> --
> View this message in context: http://www.nabble.com/The-dialog-is-not-displayed-immediatelly-tp24533044p24737894.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: The dialog is not displayed immediatelly

Tom Grahame
Erik,

Thanks for explaining why my solution did not work and providing two alternatives for me to try.

I am now using the xxforms:modal attribute as it provides the busy/waiting feedback I want to display, the actual submission results I forward to another page after the submission.

It now works beautifully...

Best wishes,

Tom

Erik Bruchez wrote
Tom,

That won't work as is, because the dialog won't show before the Ajax
request sent to the server comes back, which happens after the
submission completes.

To support such scenarios we would some kind of continuations
mechanism, which we don't have yet.

You can work around this by forcing back and forths between the client
and the server, e.g.:

* Server opens dialog and runs xxforms:script which dispatches custom event
* Client shows dialog and sends back custom event to server
* Server receives custom event and starts submission
* When submission completes you can close the dialog

Note that we also have xforms:trigger/@xxforms:modal="true" which
shows a built-in waiting screen. That might work for you and be
simpler.

-Erik

On Thu, Jul 30, 2009 at 5:53 AM, Tom
Grahame<thomas.grahame@manchester.ac.uk> wrote:
>
> Hi,
>
> I am trying to do almost exactly the same thing - use a dialog to display
> feedback to the user during a long submission.
>
> I am trying this:
>
> <xxforms:dialog id="feedback">
>        <xforms:action ev:event="xxforms-dialog-open">
>                <xforms:insert context="instance('results')"
> origin="xxforms:call-xpl..."/>
>        </xforms:action>
> </xxforms:dialog>
>
> According to the logs xxforms-dialog-open is dispatched before the insert
> occurs, yet the dialog does not appear until after the xpl has completed.
>
> Thanks,
>
> Tom
>
>
> JamesGu wrote:
>>
>> Hi,
>>
>> I am using a dialog to display a processing image before submission
>> because sometimes the submission takes long time.
>>
>> What I want is:
>> 1. Display the dialog
>> 2. do submission
>> 3. close dialog when submission done.
>> But actually the dialog is displayed after submission. I am not sure why.
>> Any suggestion will be appreciated.
>>
>>         <xforms:submission id="get-submission"
>>                            ref="instance('request')"
>>                            replace="instance"
>>                            instance="result"
>>                            method="post"
>>                            action="/test">
>>             <xforms:action ev:event="xforms-submit">
>>                 <xxforms:show dialog="processing-dialog"/>
>>             </xforms:action>-
>>             <xforms:action ev:event="xforms-submit-done">
>>                
>>             </xforms:action>
>>         </xforms:submission>
>>
>> Thanks,
>> James
>>
>
> --
> View this message in context: http://www.nabble.com/The-dialog-is-not-displayed-immediatelly-tp24533044p24737894.html
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
>
> --
> You receive this message as a subscriber of the ops-users@ow2.org mailing list.
> To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
> For general help: mailto:sympa@ow2.org?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: The dialog is not displayed immediatelly

James Gu
In reply to this post by Erik Bruchez
Erik,

The xforms:trigger/@xxforms:modal="true" is really nice. That's what I want. Thank you very much!

I have some questions about it.

                            <xforms:input ref=".">
                                <xforms:action ev:event="DOMActivate" ev:propagate="stop">
                                    <xforms:dispatch name="DOMActivate" target="search-trigger"/>
                                </xforms:action>
                            </xforms:input>
                            <xforms:trigger appearance="minimal" id="search-trigger" xxforms:modal="true">
                                <xforms:label>Search</xforms:label>
                                <xforms:action ev:event="DOMActivate">
                                    <xforms:send submission="search-submission"/>
                                </xforms:action>
                            </xforms:trigger>

When I clicks the xforms:trigger, the waiting screen works well.
I put a xforms:input on page. The user inputs some data and press "Enter". It will dispatch a DOMActivate event to the xforms:trigger. I expect the waiting screen but it is not displayed. Is there anyway to make it displayed?

Also, I modified xforms-min.js to customize the waiting screen. Please let me know if there is better way.


Thanks,
James


Reply | Threaded
Open this post in threaded view
|

Re: Re: The dialog is not displayed immediatelly

Alessandro Vernet
Administrator
James,

JamesGu wrote
The xforms:trigger/@xxforms:modal="true" is really nice. That's what I want. Thank you very much!

I have some questions about it.

                            <xforms:input ref=".">
                                <xforms:action ev:event="DOMActivate" ev:propagate="stop">
                                    <xforms:dispatch name="DOMActivate" target="search-trigger"/>
                                </xforms:action>
                            </xforms:input>
                            <xforms:trigger appearance="minimal" id="search-trigger" xxforms:modal="true">
                                <xforms:label>Search</xforms:label>
                                <xforms:action ev:event="DOMActivate">
                                    <xforms:send submission="search-submission"/>
                                </xforms:action>
                            </xforms:trigger>

When I clicks the xforms:trigger, the waiting screen works well.
I put a xforms:input on page. The user inputs some data and press "Enter". It will dispatch a DOMActivate event to the xforms:trigger. I expect the waiting screen but it is not displayed. Is there anyway to make it displayed?
Yes, that won't work because the xxforms:modal="true" is really tied to the user activating the trigger (pressing the button), not the DOMActivate event being dispatched to the trigger. As soon as a modal button is pressed, there is some JavaScript code that shows the spinning icon *before* the DOMActivate is dispatched to the server. This also avoids the "double submission" problem.

What you can do is to, upon DOMActivate on the input, simulate a click on the trigger. The input trigger would become:

    <xforms:input ref=".">
        <xforms:action ev:event="DOMActivate" ev:propagate="stop">
            <xxforms:script name="DOMActivate">
                ORBEON.xforms.Events.click({target: YAHOO.util.Dom.get("search-trigger") });
            </xxforms:script>
        </xforms:action>
    </xforms:input>

JamesGu wrote
Also, I modified xforms-min.js to customize the waiting screen. Please let me know if there is better way.
I would change xforms.js instead of xforms-min.js, and then run the minimizer to generate xforms-min.js (see the target orbeon-minify-maybe-js in build.xml). But yes, essentially you'd have to change displayModalProgressPanel in xforms.js. Other than changing the spinning icon with CSS, there isn't much you can do at this point without changing xforms.js. You'll let us know if you have ideas on how to make this more generic.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: The dialog is not displayed immediatelly

James Gu
Alex,

It works well. Thank you very much! I learned new knowledge. :-)

James
Reply | Threaded
Open this post in threaded view
|

Re: Re: The dialog is not displayed immediatelly

Alessandro Vernet
Administrator
James,

JamesGu wrote
It works well. Thank you very much! I learned new knowledge. :-)
I am glad it worked; thank you for the update!

Alex