dispatch fr-show event not working inside xbl component

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

dispatch fr-show event not working inside xbl component

mabu
Hi,

in a form I am able to call the error-dialog with following code:
<xf:dispatch ev:event="DOMActivate" name="fr-show" targetid="fr-error-dialog">
        <xxf:context name="message">An error occured...</xxf:context>
</xf:dispatch>

If I want to call it from inside a xbl component it doesn't work. Nothing happens!?

Martin
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

Alessandro  Vernet
Administrator
Hi Martin,

I tried, and for me your action does show the dialog:
http://i.imgur.com/TviS9aT.png

And here is the source of the form, created with Form Builder:
https://gist.github.com/avernet/0a6642b4bf00e1189114

Does this help, or is your case different?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

mabu
Hi Alex,

This case works for me too.
My use case is that I want to dispatch this event from inside an XBL component. There it does not work. Nothing happens!

Martin
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

Alessandro  Vernet
Administrator
Hi Martin,

I suspect that might be because you're in inner scope, and fr-error-dialog is in the outer scope. Maybe try something like:

<xf:action event="DOMActivate">
    <xf:dispatch xxbl:scope="outer" name="fr-show" targetid="fr-error-dialog">
        <xxf:context name="message">An error occurred...</xxf:context>
    </xf:dispatch>
</xf:action>

Also, note that looking at the orbeon.log with "development-level" logging (see below) should help in cases like this, as you'll see there what happens when you click on the trigger. Was the event at all dispatched? If it was, did it then fail to find fr-error-dialog?

http://doc.orbeon.com/configuration/advanced/xforms-logging.html#development-configuration

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

mabu
Hi Alex,

If I use xxbl:scope="outer" then I see a NPE in the log.
Without using xxbl:scope="outer" I get following warning message in the log:
2016-01-26 08:07:44,485 WARN  XFormsServer  - xf:dispatch - cannot find target, ignoring action {target id: "fr-error-dialog"}

Martin
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

Alessandro  Vernet
Administrator
Hi Martin,

The error message you get without the xxbl:scope="outer" seems correct. However the NPE you get with the xxbl:scope="outer" looks like a bug. Would you be able to create a simple example that we can run here to reproduce this?

Alex

On Mon, Jan 25, 2016 at 11:20 PM mabu <[hidden email]> wrote:
Hi Alex,

If I use xxbl:scope="outer" then I see a  NPE
<http://discuss.orbeon.com/file/n4660977/npe.txt>   in the log.
Without using xxbl:scope="outer" I get following warning message in the log:
2016-01-26 08:07:44,485 WARN  XFormsServer  - xf:dispatch - cannot find
target, ignoring action {target id: "fr-error-dialog"}

Martin

--
View this message in context: http://discuss.orbeon.com/dispatch-fr-show-event-not-working-inside-xbl-component-tp4660952p4660977.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

mabu
Hi Alex,

here is the simple xbl component and the form.

I found out that the NPE only occurs if I want to dispatch the fr-show event on "xforms-submit-error" or "xforms-submit-done". It works If I dispatch the fr-show event on "DOMActivate" of the trigger.

Martin
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

Alessandro  Vernet
Administrator
Hi Martin,

Thank you for test case, and I see: running something in outer scope from the model isn't supported, and we're not sure we want to support it, as we'd like to move in the direction of replacing scopes with something better. But this is another discussion ;).

However, in this case, a better way would be to call the action error-message(message = "An error occurred..."), see:

http://doc.orbeon.com/form-runner/advanced/buttons-and-processes/actions-form-runner.html#successmessage-and-errormessage

You can call it from XPath process:runProcess(), which ideally should be exposed as an XPath Form Runner function. We have an RFE for this, which I +1 for you:
https://github.com/orbeon/orbeon-forms/issues/2214

So your handler for xforms-submit-error would look like:
https://gist.github.com/avernet/06d8ab14cc147682f548

Does this work for you?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

mabu
Alex, thank you for the advice. It works!
Reply | Threaded
Open this post in threaded view
|

Re: dispatch fr-show event not working inside xbl component

Alessandro  Vernet
Administrator
Martin, excellent, and thanks for confirming.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet