Hello,
we try to get actions done after the form has been loaded. Unfortunately, this seem to be a problem now with Orbeon Forms 4.4.0.201311042001 CE. This is my example: <?xml version="1.0" encoding="UTF-8"?> <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> <xhtml:head> <xf:action ev:event="hugo"> <xf:message>Hi Hugo!</xf:message> </xf:action> <xf:action ev:event="knut"> <xf:message>Hi Knut!</xf:message> </xf:action> <xhtml:title>My Example</xhtml:title> <xf:model> <xf:instance> <my-instance xmlns=""/> </xf:instance> <!-- the following dispatch is not working, why? --> <xf:dispatch ev:event="xforms-model-construct-done" name="hugo" targetid="#document"/> <!-- the following dispatch is working! --> <xf:dispatch ev:event="xforms-ready" name="knut" targetid="#document"/> <xf:action ev:event="xforms-model-construct-done"> <xf:message>xforms-model-construct-done!</xf:message> <!-- the following dispatch is not working, why? --> <xf:dispatch name="hugo" targetid="#document"/> <xf:dispatch name="knut" targetid="#document"/> </xf:action> </xf:model> </xhtml:head> <xhtml:body> <fr:button> <xf:label>Hi all</xf:label> <xf:message ev:event="DOMActivate">pressed</xf:message> <xf:dispatch ev:event="DOMActivate" name="hugo" targetid="#document"/> <xf:dispatch ev:event="DOMActivate" name="knut" targetid="#document"/> </fr:button> </xhtml:body> </xhtml:html> I'd expect both messages, Hugo and Knut, showing up after the form has been loaded. What's wrong here? Thanks a lot for some hints. Cheers Heinrich -- Before printing this e-mail, think about our environmental responsibility. -- 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]. |
Hi Heinrich,
You're not dispatching your events correctly... The targetid attribute is expecting the value of the id (without a leading #) and it appears that there is no id = 'document' in your page. The following will do what you're expecting: <?xml version="1.0" encoding="UTF-8"?> <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> <xhtml:head> <xhtml:title>My Example</xhtml:title> <xf:model id="model"> <xf:instance> <my-instance xmlns=""/> </xf:instance> <xf:action ev:event="hugo"> <xf:message>Hi Hugo!</xf:message> </xf:action> <xf:action ev:event="knut"> <xf:message>Hi Knut!</xf:message> </xf:action> <!-- the following dispatch is not working, why? --> <xf:dispatch ev:event="xforms-model-construct-done" name="hugo" targetid="model"/> <!-- the following dispatch is working! --> <xf:dispatch ev:event="xforms-ready" name="knut" targetid="model"/> <xf:action ev:event="xforms-model-construct-done"> <xf:message>xforms-model-construct-done!</xf:message> <!-- the following dispatch is not working, why? --> <xf:dispatch name="hugo" targetid="model"/> <xf:dispatch name="knut" targetid="model"/> </xf:action> </xf:model> </xhtml:head> <xhtml:body> <fr:button> <xf:label>Hi all</xf:label> <xf:message ev:event="DOMActivate">pressed</xf:message> <xf:dispatch ev:event="DOMActivate" name="hugo" targetid="model"/> <xf:dispatch ev:event="DOMActivate" name="knut" targetid="model"/> </fr:button> </xhtml:body> </xhtml:html> Hope this helps, Eric Le mardi 21 janvier 2014 à 17:10 +0100, Heinrich Götzger a écrit : > Hello, > > we try to get actions done after the form has been loaded. > Unfortunately, this seem to be a problem now with Orbeon Forms > 4.4.0.201311042001 CE. > > This is my example: > > <?xml version="1.0" encoding="UTF-8"?> > <xhtml:html > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> > > <xhtml:head> > > <xf:action ev:event="hugo"> > <xf:message>Hi Hugo!</xf:message> > </xf:action> > > <xf:action ev:event="knut"> > <xf:message>Hi Knut!</xf:message> > </xf:action> > > <xhtml:title>My Example</xhtml:title> > > <xf:model> > <xf:instance> > <my-instance xmlns=""/> > </xf:instance> > > <!-- the following dispatch is not working, why? --> > <xf:dispatch > ev:event="xforms-model-construct-done" > name="hugo" > targetid="#document"/> > > <!-- the following dispatch is working! --> > <xf:dispatch > ev:event="xforms-ready" > name="knut" > targetid="#document"/> > > <xf:action ev:event="xforms-model-construct-done"> > <xf:message>xforms-model-construct-done!</xf:message> > <!-- the following dispatch is not working, why? --> > <xf:dispatch > name="hugo" > targetid="#document"/> > <xf:dispatch > name="knut" > targetid="#document"/> > </xf:action> > > </xf:model> > > </xhtml:head> > > <xhtml:body> > > <fr:button> > <xf:label>Hi all</xf:label> > <xf:message ev:event="DOMActivate">pressed</xf:message> > <xf:dispatch > ev:event="DOMActivate" > name="hugo" > targetid="#document"/> > <xf:dispatch > ev:event="DOMActivate" > name="knut" > targetid="#document"/> > </fr:button> > > </xhtml:body> > > </xhtml:html> > > I'd expect both messages, Hugo and Knut, showing up after the form has > been loaded. > > What's wrong here? > > Thanks a lot for some hints. > > Cheers > > Heinrich > > -- > Before printing this e-mail, think about our environmental responsibility. > -- 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]. |
Hoi Eric,
thanks a lot for the quick response. Your example is working es expected. Well, but this is not exactly what we want at the end, actually. In orbeon 3.9 we used to have 'global' event-handlers which we defined outside of any model, but just using something like: <xf:action ev:event="listQuery"> <xi:include href="oxf:/standard/action/listQuery.xml"/> </xf:action> Here is a hint that this worked (we are not using the observer-attribute): http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-The-keypress-event Then, at the desired place in the form, we use something like: <!-- loads the list on load of form --> <xf:action ev:event="xforms-model-construct-done"> <xf:dispatch name="listQuery" targetid="#document"/> </xf:action> And that works just marvelous. So we can use a bunch of small actions in lots of different forms and those actions could even call each other without having any model-dependencies. This is the code we'd love to port to 4.4. And that seems to contain a few treats.... Thanks Cheers Heinrich On 01/21/14 17:38, Eric van der Vlist wrote: > Hi Heinrich, > > You're not dispatching your events correctly... > > The targetid attribute is expecting the value of the id (without a > leading #) and it appears that there is no id = 'document' in your page. > > The following will do what you're expecting: > > <?xml version="1.0" encoding="UTF-8"?> > <xhtml:html > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> > > <xhtml:head> > > > <xhtml:title>My Example</xhtml:title> > > <xf:model id="model"> > <xf:instance> > <my-instance xmlns=""/> > </xf:instance> > > <xf:action ev:event="hugo"> > <xf:message>Hi Hugo!</xf:message> > </xf:action> > > <xf:action ev:event="knut"> > <xf:message>Hi Knut!</xf:message> > </xf:action> > > > <!-- the following dispatch is not working, why? --> > <xf:dispatch > ev:event="xforms-model-construct-done" > name="hugo" > targetid="model"/> > > <!-- the following dispatch is working! --> > <xf:dispatch > ev:event="xforms-ready" > name="knut" > targetid="model"/> > > <xf:action ev:event="xforms-model-construct-done"> > <xf:message>xforms-model-construct-done!</xf:message> > <!-- the following dispatch is not working, why? --> > <xf:dispatch > name="hugo" > targetid="model"/> > <xf:dispatch > name="knut" > targetid="model"/> > </xf:action> > > </xf:model> > > </xhtml:head> > > <xhtml:body> > > <fr:button> > <xf:label>Hi all</xf:label> > <xf:message ev:event="DOMActivate">pressed</xf:message> > <xf:dispatch > ev:event="DOMActivate" > name="hugo" > targetid="model"/> > <xf:dispatch > ev:event="DOMActivate" > name="knut" > targetid="model"/> > </fr:button> > > </xhtml:body> > > </xhtml:html> > > Hope this helps, > > Eric > > Le mardi 21 janvier 2014 à 17:10 +0100, Heinrich Götzger a écrit : >> Hello, >> >> we try to get actions done after the form has been loaded. >> Unfortunately, this seem to be a problem now with Orbeon Forms >> 4.4.0.201311042001 CE. >> >> This is my example: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <xhtml:html >> xmlns:xhtml="http://www.w3.org/1999/xhtml" >> xmlns:xf="http://www.w3.org/2002/xforms" >> xmlns:ev="http://www.w3.org/2001/xml-events" >> xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> >> >> <xhtml:head> >> >> <xf:action ev:event="hugo"> >> <xf:message>Hi Hugo!</xf:message> >> </xf:action> >> >> <xf:action ev:event="knut"> >> <xf:message>Hi Knut!</xf:message> >> </xf:action> >> >> <xhtml:title>My Example</xhtml:title> >> >> <xf:model> >> <xf:instance> >> <my-instance xmlns=""/> >> </xf:instance> >> >> <!-- the following dispatch is not working, why? --> >> <xf:dispatch >> ev:event="xforms-model-construct-done" >> name="hugo" >> targetid="#document"/> >> >> <!-- the following dispatch is working! --> >> <xf:dispatch >> ev:event="xforms-ready" >> name="knut" >> targetid="#document"/> >> >> <xf:action ev:event="xforms-model-construct-done"> >> <xf:message>xforms-model-construct-done!</xf:message> >> <!-- the following dispatch is not working, why? --> >> <xf:dispatch >> name="hugo" >> targetid="#document"/> >> <xf:dispatch >> name="knut" >> targetid="#document"/> >> </xf:action> >> >> </xf:model> >> >> </xhtml:head> >> >> <xhtml:body> >> >> <fr:button> >> <xf:label>Hi all</xf:label> >> <xf:message ev:event="DOMActivate">pressed</xf:message> >> <xf:dispatch >> ev:event="DOMActivate" >> name="hugo" >> targetid="#document"/> >> <xf:dispatch >> ev:event="DOMActivate" >> name="knut" >> targetid="#document"/> >> </fr:button> >> >> </xhtml:body> >> >> </xhtml:html> >> >> I'd expect both messages, Hugo and Knut, showing up after the form has >> been loaded. >> >> What's wrong here? >> >> Thanks a lot for some hints. >> >> Cheers >> >> Heinrich >> >> -- >> Before printing this e-mail, think about our environmental responsibility. >> > -- Before printing this e-mail, think about our environmental responsibility. -- 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]. |
Le mardi 21 janvier 2014 à 19:09 +0100, Heinrich Götzger a écrit :
> Hoi Eric, > > thanks a lot for the quick response. Your example is working es expected. > > Well, but this is not exactly what we want at the end, actually. > > In orbeon 3.9 we used to have 'global' event-handlers which we defined > outside of any model, but just using something like: > > <xf:action > ev:event="listQuery"> > <xi:include > href="oxf:/standard/action/listQuery.xml"/> > </xf:action> > > Here is a hint that this worked (we are not using the observer-attribute): > http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-The-keypress-event Yes but it also says (http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-Top-level-event-handlers): "NOTE: Events from top-level models do not bubble to handlers observing on #document. Arguably, they should!" We are exactly in that case (xforms-model-construct-done is dispatched to top-levels models). Also note that if these events did bubble you would receive one for each top level model which might not be what you'd expect ;) ... > Then, at the desired place in the form, we use something like: > > <!-- loads the list on load of form --> > <xf:action > ev:event="xforms-model-construct-done"> > > <xf:dispatch > name="listQuery" > targetid="#document"/> > > </xf:action> > > And that works just marvelous. So we can use a bunch of small actions in > lots of different forms and those actions could even call each other > without having any model-dependencies. What about defining a specific model for these actions that are common too different forms? Eric > This is the code we'd love to port to 4.4. And that seems to contain a > few treats.... > > Thanks > > Cheers > > Heinrich > -- 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]. |
Good Morning Eric,
On 01/21/14 19:39, Eric van der Vlist wrote: > Le mardi 21 janvier 2014 à 19:09 +0100, Heinrich Götzger a écrit : > Yes but it also says > (http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-Top-level-event-handlers): > > "NOTE: Events from top-level models do not bubble to handlers observing > on #document. Arguably, they should!" > > We are exactly in that case (xforms-model-construct-done is dispatched > to top-levels models). Also note that if these events did bubble you > would receive one for each top level model which might not be what you'd > expect ;) ... We registered the handler on #document, in 3.9, right? Dispatching events from somewhere to #document (even from a xforms-model-construct-done-handler in some model) worked in 3.9. This was on purpose or by accident? Fires dispatch not a new event? > What about defining a specific model for these actions that are common > too different forms? Yes, we thought about that already as well. But this solution is only partially beautiful, because we always have to add all handlers in a particular model, and the flexibility is lostto some extent. Hm, looks like, this is the only way right now. Thanks Cheers Heinrich -- Before printing this e-mail, think about our environmental responsibility. -- 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]. |
In reply to this post by Eric van der Vlist
Salute,
if I use the following example, why is the HelloWorld1 event getting dispatched from inside the top-level model but HelloWorld2 not? This works in 3.9 completely, but in 4.4 only partially. Sorry for insisting, but I would like to avoid the introduction of an extra event model, since this seems to be not as flexible as it used to be. Thanks Cheers Heinrich <?xml version="1.0" encoding="UTF-8"?> <xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> <xhtml:head> <xf:action ev:event="HelloWorld1"> <xf:message>Hallo xforms-ready World</xf:message> </xf:action> <xf:action ev:event="HelloWorld2"> <xf:message>Hallo xforms-model-construct-done World</xf:message> </xf:action> <xhtml:title>My Event</xhtml:title> <xf:model> <xf:instance> <my-instance xmlns=""/> </xf:instance> <xf:dispatch ev:event="xforms-ready" name="HelloWorld1" targetid="#document"> </xf:dispatch> <xf:dispatch ev:event="xforms-model-construct-done" name="HelloWorld2" targetid="#document"> </xf:dispatch> <xf:message ev:event="xforms-model-construct-done">xforms-model-construct-done</xf:message> <xf:message ev:event="xforms-ready">xforms-ready</xf:message> </xf:model> </xhtml:head> <xhtml:body/> </xhtml:html> -- 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]. |
Hi Heinrich,
I don't know why the behaviour has changed between 3.9 and 4.4. Erik and/or Alex should be able to answer, but if you think that this is an issue, why don't you create a new issue in github: https://github.com/orbeon/orbeon-forms/issues ? Cheers, Eric Le mercredi 22 janvier 2014 à 19:31 +0100, Heinrich Götzger a écrit : > Salute, > > if I use the following example, why is the HelloWorld1 event getting > dispatched from inside the top-level model but HelloWorld2 not? > > This works in 3.9 completely, but in 4.4 only partially. > > Sorry for insisting, but I would like to avoid the introduction of an > extra event model, since this seems to be not as flexible as it used to be. > > Thanks > > Cheers > > Heinrich > > <?xml version="1.0" encoding="UTF-8"?> > <xhtml:html > xmlns:xhtml="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:fr="http://orbeon.org/oxf/xml/form-runner"> > > <xhtml:head> > > <xf:action ev:event="HelloWorld1"> > <xf:message>Hallo xforms-ready World</xf:message> > </xf:action> > > <xf:action ev:event="HelloWorld2"> > <xf:message>Hallo xforms-model-construct-done World</xf:message> > </xf:action> > > <xhtml:title>My Event</xhtml:title> > > <xf:model> > <xf:instance> > <my-instance xmlns=""/> > </xf:instance> > > <xf:dispatch > ev:event="xforms-ready" > name="HelloWorld1" > targetid="#document"> > </xf:dispatch> > > <xf:dispatch > ev:event="xforms-model-construct-done" > name="HelloWorld2" > targetid="#document"> > </xf:dispatch> > > <xf:message > ev:event="xforms-model-construct-done">xforms-model-construct-done</xf:message> > > <xf:message ev:event="xforms-ready">xforms-ready</xf:message> > > </xf:model> > > </xhtml:head> > > <xhtml:body/> > > </xhtml:html> > -- 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]. |
Hi Eric,
thanks for the hint, it's issue #1502: https://github.com/orbeon/orbeon-forms/issues/1502 Cheers Heinrich -- Before printing this e-mail, think about our environmental responsibility. -- 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]. |
Administrator
|
Heinrich,
Thanks, I have commented on the bug: https://github.com/orbeon/orbeon-forms/issues/1502 -Erik |
Erik,
great, is there anything else I can do? Heinrich On 01/24/14 01:33, Erik Bruchez wrote: > Heinrich, > > Thanks, I have commented on the bug: > > https://github.com/orbeon/orbeon-forms/issues/1502 > > -Erik > > -- > View this message in context: http://discuss.orbeon.com/Why-is-xforms-model-construct-done-on-load-not-working-tp4657888p4657923.html > Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com. > -- Before printing this e-mail, think about our environmental responsibility. -- 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]. |
Administrator
|
Heinrich,
If you're looking for a workaround or other way to do this, you could be dispatching the event to a model id, and put the handler in that model. Would that work for you? That should work on xforms-model-construct-done. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hoi Alex,
we decided for this reason and some other reason to create separate xbl-components which include exactly those handlers in their models. So these handlers are out of the way in the containing form now. But thank you for the suggestion. We thought about that too already. Heinrich -- Before printing this e-mail, think about our environmental responsibility. -- 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]. |
Administrator
|
Hi Heinrich,
Great, I glad you found a solution to this one, and thank you for the update. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |