Thread: [Xsltforms-support] xf:setvalue/@ev:event="xforms-enabled" not working
Brought to you by:
alain-couthures
From: Eric v. d. V. <vd...@dy...> - 2013-08-23 13:29:36
|
Hi, Title says it all ;) ... If you try: <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet href="xsltforms.xsl" type="text/xsl"?> <?xsltforms-options debug="yes"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events"> <head> <title>Hello World in XForms</title> <xf:model id="model"> <xf:instance id="instance" xmlns=""> <data> <PersonGivenName></PersonGivenName> <show>control-1</show> </data> </xf:instance> <xf:instance id="controls" xmlns=""> <controls> <control-1>disabled</control-1> <control-2>disabled</control-2> </controls> </xf:instance> </xf:model> </head> <body> <xf:select ref="show" appearance="full"> <xf:label>Display: </xf:label> <xf:item> <xf:label>control-1</xf:label> <xf:value>control-1</xf:value> </xf:item> <xf:item> <xf:label>control-2</xf:label> <xf:value>control-2</xf:value> </xf:item> </xf:select> <br /> <xf:group ref="instance('controls')"> <xf:output ref="control-1"> <xf:label>control-1</xf:label> </xf:output> <xf:output ref="control-2"> <xf:label>control-2</xf:label> </xf:output> </xf:group> <br /> <xf:input ref="PersonGivenName[contains(../show, 'control-1')]"> <xf:label>control-1 :</xf:label> <xf:message ev:event="xforms-enabled">Coucou</xf:message> <xf:setvalue ev:event="xforms-enabled" ref="instance('controls')/control-1">enabled</xf:setvalue> <xf:setvalue ev:event="xforms-disabled" ref="instance('controls')/control-1">disabled</xf:setvalue> </xf:input> <br /> <xf:input ref="PersonGivenName[contains(../show, 'control-2')]"> <xf:label>control-2 :</xf:label> <xf:setvalue ev:event="xforms-enabled" ref="instance('controls')/control-2">enabled</xf:setvalue> <xf:setvalue ev:event="xforms-disabled" ref="instance('controls')/control-2">disabled</xf:setvalue> </xf:input> </body> </html> You'll see that the "controls" instance is never updated (as it should). Thanks, Eric |
From: Alain C. <ala...@ag...> - 2013-09-06 13:42:50
|
Hello Eric, While improving event management in XSLTForms for this test case, I would like to know if you deliberately make it with an inconsistency: <xf:instance id="instance" xmlns=""> <data> <PersonGivenName></PersonGivenName> <show>control-1</show> </data> </xf:instance> <xf:instance id="controls" xmlns=""> <controls> <control-1>*_disabled_*</control-1> <control-2>disabled</control-2> </controls> </xf:instance> instead of <xf:instance id="instance" xmlns=""> <data> <PersonGivenName></PersonGivenName> <show>control-1</show> </data> </xf:instance> <xf:instance id="controls" xmlns=""> <controls> <control-1>*_enabled_*</control-1> <control-2>disabled</control-2> </controls> </xf:instance> This inconsistency is clearly disturbing with XSLTForms because events are fired only after the form being ready. What do you think? Thanks! -Alain Le 23/08/2013 15:29, Eric van der Vlist a écrit : > Hi, > > Title says it all ;) ... > > If you try: > <?xml version="1.0" encoding="utf-8"?> > <?xml-stylesheet href="xsltforms.xsl" type="text/xsl"?> > <?xsltforms-options debug="yes"?> > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xf="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events"> > <head> > <title>Hello World in XForms</title> > <xf:model id="model"> > <xf:instance id="instance" xmlns=""> > <data> > <PersonGivenName></PersonGivenName> > <show>control-1</show> > </data> > </xf:instance> > <xf:instance id="controls" xmlns=""> > <controls> > <control-1>disabled</control-1> > <control-2>disabled</control-2> > </controls> > </xf:instance> > </xf:model> > </head> > <body> > <xf:select ref="show" appearance="full"> > <xf:label>Display: </xf:label> > <xf:item> > <xf:label>control-1</xf:label> > <xf:value>control-1</xf:value> > </xf:item> > <xf:item> > <xf:label>control-2</xf:label> > <xf:value>control-2</xf:value> > </xf:item> > </xf:select> > <br /> > <xf:group ref="instance('controls')"> > <xf:output ref="control-1"> > <xf:label>control-1</xf:label> > </xf:output> > <xf:output ref="control-2"> > <xf:label>control-2</xf:label> > </xf:output> > </xf:group> > <br /> > <xf:input ref="PersonGivenName[contains(../show, 'control-1')]"> > <xf:label>control-1 :</xf:label> > <xf:message ev:event="xforms-enabled">Coucou</xf:message> > <xf:setvalue ev:event="xforms-enabled" > ref="instance('controls')/control-1">enabled</xf:setvalue> > <xf:setvalue ev:event="xforms-disabled" > ref="instance('controls')/control-1">disabled</xf:setvalue> > </xf:input> > <br /> > <xf:input ref="PersonGivenName[contains(../show, 'control-2')]"> > <xf:label>control-2 :</xf:label> > <xf:setvalue ev:event="xforms-enabled" > ref="instance('controls')/control-2">enabled</xf:setvalue> > <xf:setvalue ev:event="xforms-disabled" > ref="instance('controls')/control-2">disabled</xf:setvalue> > </xf:input> > </body> > </html> > > You'll see that the "controls" instance is never updated (as it should). > > Thanks, > > Eric > > > ------------------------------------------------------------------------------ > Introducing Performance Central, a new site from SourceForge and > AppDynamics. Performance Central is your source for news, insights, > analysis and resources for efficient Application Performance Management. > Visit us today! > http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > |
From: Eric v. d. V. <vd...@dy...> - 2013-09-19 08:26:29
|
Hi Alain, Le vendredi 06 septembre 2013 à 16:30 +0200, Eric van der Vlist a écrit : > I'll keep you updated on my progress! A solution should be to make sure controls are in a predicable state when xforms-ready fires so that you can then track their status. I have added an instance: <xf:instance id="xfu-init"> <init xmlns="">false</init> </xf:instance> This instance is updated on xforms-ready: <xf:action ev:event="xforms-ready"> <xf:setvalue ref="instance('xfu-init')">true</xf:setvalue> <xf:recalculate></xf:recalculate> <xf:refresh></xf:refresh> </xf:action> And all the controls are embedded in this group: <xf:group ref=".[instance('xfu-init') = 'true']"> .../... </xf:group> For whatever reason, this group is never enabled! I am testing with the build directory of your latest commit: > commit a7879461945997de25c848aa64f538aa713741ab > Author: Alain Couthures <ala...@ag...> > Date: Fri Sep 13 14:31:12 2013 +0200 > > Insertion of non-relevant node > > Signed-off-by: Alain Couthures <ala...@ag...> (Complete repro: http://xformsunit.org/trac/browser/sandbox/track-xforms-enable-disable-workaround.xhtml?rev=35d9c347f9a7e419cc44b306be99d147e33a4de5 ) Thanks, Eric |
From: Alain C. <ala...@ag...> - 2013-09-19 19:35:51
|
Hi Eric, The issue is due to the document element not being added in the dependency nodeset: this testcase works if the tested node is not the document element but a subnode: <xf:instance id="xfu-init"> <init xmlns="" status="false"/> </xf:instance> <xf:action ev:event="xforms-ready"> <xf:setvalue ref="instance('xfu-init')/@status">true</xf:setvalue> <xf:recalculate></xf:recalculate> <xf:refresh></xf:refresh> </xf:action> <xf:group ref=".[instance('xfu-init')/@status = 'true']"> I will fix this as soon as possible. Thanks! -Alain Le 19/09/2013 10:26, Eric van der Vlist a écrit : > Hi Alain, > > Le vendredi 06 septembre 2013 à 16:30 +0200, Eric van der Vlist a > écrit : > >> I'll keep you updated on my progress! > A solution should be to make sure controls are in a predicable state > when xforms-ready fires so that you can then track their status. > > I have added an instance: > > <xf:instance id="xfu-init"> > <init xmlns="">false</init> > </xf:instance> > > This instance is updated on xforms-ready: > > <xf:action ev:event="xforms-ready"> > <xf:setvalue ref="instance('xfu-init')">true</xf:setvalue> > <xf:recalculate></xf:recalculate> > <xf:refresh></xf:refresh> > </xf:action> > > And all the controls are embedded in this group: > > <xf:group ref=".[instance('xfu-init') = 'true']"> > .../... > </xf:group> > > For whatever reason, this group is never enabled! > > I am testing with the build directory of your latest commit: > >> commit a7879461945997de25c848aa64f538aa713741ab >> Author: Alain Couthures <ala...@ag...> >> Date: Fri Sep 13 14:31:12 2013 +0200 >> >> Insertion of non-relevant node >> >> Signed-off-by: Alain Couthures <ala...@ag...> > (Complete repro: > http://xformsunit.org/trac/browser/sandbox/track-xforms-enable-disable-workaround.xhtml?rev=35d9c347f9a7e419cc44b306be99d147e33a4de5 ) > > Thanks, > > Eric > > |
From: Alain C. <ala...@ag...> - 2013-09-23 06:34:56
|
Hi Eric, > I have added an instance: > > <xf:instance id="xfu-init"> > <init xmlns="">false</init> > </xf:instance> > > This instance is updated on xforms-ready: > > <xf:action ev:event="xforms-ready"> > <xf:setvalue ref="instance('xfu-init')">true</xf:setvalue> > <xf:recalculate></xf:recalculate> > <xf:refresh></xf:refresh> > </xf:action> > > And all the controls are embedded in this group: > > <xf:group ref=".[instance('xfu-init') = 'true']"> > .../... > </xf:group> > > For whatever reason, this group is never enabled! > This has been fixed in the latest build: the instance() function did not notice that the resulting node had to be considered as a dependency. Thank you for your feedbacks! -Alain |
From: Eric v. d. V. <vd...@dy...> - 2013-09-06 14:30:24
|
Hi Alain, Le vendredi 06 septembre 2013 à 15:42 +0200, Alain Couthures a écrit : .../... > This inconsistency is clearly disturbing with XSLTForms because events > are fired only after the form being ready. > > What do you think? That would explain it but. Re-reading the implementation I think that you are right and that implementations do not have to fire events to the controls before xforms-ready and thus do not have to initially tell them if they are enabled or not. This seems like a design flaw to me (controls do not have any easy way to determine their initial status) and Orbeon Forms does send these events! If that's a case I must find a workaround (probably embedding the controls in a group which is initially invalid to be sure of their initial status, make this group valid and dispatch an xforms-refresh to get their actual statuses). I'll keep you updated on my progress! Thanks, Eric > > Thanks! > > -Alain > > |