Hi, We are developing some complex xbl components. They’re generally made up of many xforms controls and have their own xml model. We would really like to use a local model and xform binding but we are struggling to do this without having an insert and delete (the parent model) action fired on every field change. We have many control so this is cumbersome to develop and probably quite inefficient (example below). Is there another way we can do this but maintaining the ability to use binding? If we can’t use binding we will have to use “ref” but can we get the same features as binding (readonly, type, relevant etc)? Many Thanks, Daniel <xforms:group ref="$outer-binding"> <xf:select1 bind="method-bind"> -- 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 |
Administrator
|
Daniel,
To be fair, as things stand, we are not very happy with how events are handled with our XBL implementation. One way that often helps is to simply stop the propagation of internal events with: <xf:action ev:event="#all" ev:propagate="stop"/> This is used for example in this component: https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/dropdown-date/dropdown-date.xbl You can also selectively filter events, by specifying them on the ev:event="…" attribute. -Erik On Thu, Jul 14, 2011 at 2:25 AM, Daniel R. Klemm <[hidden email]> wrote: > Hi, > > We are developing some complex xbl components. They’re generally made up of > many xforms controls and have their own xml model. We would really like to > use a local model and xform binding but we are struggling to do this without > having an insert and delete (the parent model) action fired on every field > change. We have many control so this is cumbersome to develop and probably > quite inefficient (example below). > > Is there another way we can do this but maintaining the ability to use > binding? If we can’t use binding we will have to use “ref” but can we get > the same features as binding (readonly, type, relevant etc)? > > Many Thanks, > > Daniel > > <xforms:group ref="$outer-binding"> > <xf:insert ev:event="xforms-value-changed" > ref="$outer-binding" > if="not(exists($outer-binding))" > origin="instance('admission-model')"/> > </xforms:group> > > <xf:select1 bind="method-bind"> > <xforms:label>Method of admission:</xforms:label> > <xforms:itemset nodeset="instance('admission-methods')/method"> > <xforms:label ref="."/> > <xforms:value ref="@nationalcode"/> > </xforms:itemset> > > <xf:action ev:event="xforms-value-changed"> > <xf:insert ev:event="xforms-value-changed" > ref="$outer-binding" > origin="instance('admission-model')"/> > <xf:delete "old model" /> > </xf:action> > > </xf:select1> > > > -- > 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 |
We have the events working fine, we have also stopped propagation user the method you suggested.
We need to use binding so have gone down the approach of setting a local model to the parent bind. We cannot get the local xbl model back the xform, I think this is because we cannot use both scopes (inner and outer) in the same xforms declaration (insert or delete). We have spent about 30 hours on this problem already, is this even possible? Many Thanks, Daniel <!-- Set the inner model to the outer model (this is working perfectly!)--> <xforms:group bind="admission-template-bind"> <xf:action ev:event="xforms-enabled"> <xf:insert nodeset="." origin="$outer-binding"/> </xf:action> </xforms:group> <xf:action ev:event="xforms-value-changed"> <!-- Somehow here we need to replace the outer model with the inner model We have tried all combinations of insert, delete and set value but cannot get this working. --> <xf:message ref="." xxbl:scope="outer"></xf:message> <xf:message ref="." xxbl:scope="inner"></xf:message> </xf:action> ________________________________ From: [hidden email] on behalf of Erik Bruchez Sent: Fri 15/07/2011 02:33 To: [hidden email] Subject: [ops-users] Re: xbl and binding Daniel, To be fair, as things stand, we are not very happy with how events are handled with our XBL implementation. One way that often helps is to simply stop the propagation of internal events with: <xf:action ev:event="#all" ev:propagate="stop"/> This is used for example in this component: https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/dropdown-date/dropdown-date.xbl You can also selectively filter events, by specifying them on the ev:event="..." attribute. -Erik On Thu, Jul 14, 2011 at 2:25 AM, Daniel R. Klemm <[hidden email]> wrote: > Hi, > > We are developing some complex xbl components. They're generally made up of > many xforms controls and have their own xml model. We would really like to > use a local model and xform binding but we are struggling to do this without > having an insert and delete (the parent model) action fired on every field > change. We have many control so this is cumbersome to develop and probably > quite inefficient (example below). > > Is there another way we can do this but maintaining the ability to use > binding? If we can't use binding we will have to use "ref" but can we get > the same features as binding (readonly, type, relevant etc)? > > Many Thanks, > > Daniel > > <xforms:group ref="$outer-binding"> > <xf:insert ev:event="xforms-value-changed" > ref="$outer-binding" > if="not(exists($outer-binding))" > origin="instance('admission-model')"/> > </xforms:group> > > <xf:select1 bind="method-bind"> > <xforms:label>Method of admission:</xforms:label> > <xforms:itemset nodeset="instance('admission-methods')/method"> > <xforms:label ref="."/> > <xforms:value ref="@nationalcode"/> > </xforms:itemset> > > <xf:action ev:event="xforms-value-changed"> > <xf:insert ev:event="xforms-value-changed" > ref="$outer-binding" > origin="instance('admission-model')"/> > <xf:delete "old model" /> > </xf:action> > > </xf:select1> > > > -- > 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 winmail.dat (10K) Download Attachment |
It should work.
<!-- With an assumption that you are in inner scope --> <xforms:setvalue ref="$outer-binding" value="instance()" ev:event="xforms-value-changed" />
When you change the value, is it firing xforms-value-changed? Are you able to see the message from xf:message?
On Mon, Jul 18, 2011 at 5:38 AM, Daniel R. Klemm <[hidden email]> wrote: We have the events working fine, we have also stopped propagation user the method you suggested. -- 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 |
Tried that and it only seems to work for single node/value elements. We have a complex xml model and each xbl component is made up of many xform controls. I've search up and down the forum and internet for someone trying to do the same thing, I'm really surprised no one asked about this or experienced that same problems.
Here are the setvalue options we've tried. <!-- Creates a new xml document and appends it in, so we can't use this --> <xf:setvalue ref="$outer-binding" context="instance('admission-model')" value="saxon:serialize(context(), 'xml')"/> <!-- Set the text only, so it only take the values of the local model not the xml structure --> <xf:setvalue ref="$outer-binding" context="instance('admission-model')" value="context()"/> <!-- Seen this is an only demo so gave it a go, dosn't work either --> <xf:setvalue ref="$outer-binding" context="instance('admission-model')" value="codepoints-to-string(reverse(string-to-codepoints(context())))"/> ________________________________ From: Binesh Gummadi [mailto:[hidden email]] Sent: Mon 18/07/2011 12:11 To: [hidden email] Subject: [ops-users] Re: RE: Re: xbl and binding It should work. <!-- With an assumption that you are in inner scope --> <xforms:setvalue ref="$outer-binding" value="instance()" ev:event="xforms-value-changed" /> When you change the value, is it firing xforms-value-changed? Are you able to see the message from xf:message? ________________________________ Binesh Gummadi Senior Software Engineer rivetlogic <http://www.rivetlogic.com/> Voice +1.703.879.5740 Skype binesh.gummadi_rivetlogic GTalk [hidden email] <mailto:bgummadi%40rivetlogic.com> Calendar binesh gummadi's calendar <http://www.google.com/calendar/hosted/rivetlogic.com/embed?src=bgummadi%40rivetlogic.com&ctz=America/New_York> On Mon, Jul 18, 2011 at 5:38 AM, Daniel R. Klemm <[hidden email]> wrote: We have the events working fine, we have also stopped propagation user the method you suggested. We need to use binding so have gone down the approach of setting a local model to the parent bind. We cannot get the local xbl model back the xform, I think this is because we cannot use both scopes (inner and outer) in the same xforms declaration (insert or delete). We have spent about 30 hours on this problem already, is this even possible? Many Thanks, Daniel <!-- Set the inner model to the outer model (this is working perfectly!)--> <xforms:group bind="admission-template-bind"> <xf:action ev:event="xforms-enabled"> <xf:insert nodeset="." origin="$outer-binding"/> </xf:action> </xforms:group> <xf:action ev:event="xforms-value-changed"> <!-- Somehow here we need to replace the outer model with the inner model We have tried all combinations of insert, delete and set value but cannot get this working. --> <xf:message ref="." xxbl:scope="outer"></xf:message> <xf:message ref="." xxbl:scope="inner"></xf:message> </xf:action> ________________________________ From: [hidden email] on behalf of Erik Bruchez Sent: Fri 15/07/2011 02:33 To: [hidden email] Subject: [ops-users] Re: xbl and binding Daniel, To be fair, as things stand, we are not very happy with how events are handled with our XBL implementation. One way that often helps is to simply stop the propagation of internal events with: <xf:action ev:event="#all" ev:propagate="stop"/> This is used for example in this component: https://github.com/orbeon/orbeon-forms/blob/master/src/resources-packaged/xbl/orbeon/dropdown-date/dropdown-date.xbl You can also selectively filter events, by specifying them on the ev:event="..." attribute. -Erik On Thu, Jul 14, 2011 at 2:25 AM, Daniel R. Klemm <[hidden email]> wrote: > Hi, > > We are developing some complex xbl components. They're generally made up of > many xforms controls and have their own xml model. We would really like to > use a local model and xform binding but we are struggling to do this without > having an insert and delete (the parent model) action fired on every field > change. We have many control so this is cumbersome to develop and probably > quite inefficient (example below). > > Is there another way we can do this but maintaining the ability to use > binding? If we can't use binding we will have to use "ref" but can we get > the same features as binding (readonly, type, relevant etc)? > > Many Thanks, > > Daniel > > <xforms:group ref="$outer-binding"> > <xf:insert ev:event="xforms-value-changed" > ref="$outer-binding" > if="not(exists($outer-binding))" > origin="instance('admission-model')"/> > </xforms:group> > > <xf:select1 bind="method-bind"> > <xforms:label>Method of admission:</xforms:label> > <xforms:itemset nodeset="instance('admission-methods')/method"> > <xforms:label ref="."/> > <xforms:value ref="@nationalcode"/> > </xforms:itemset> > > <xf:action ev:event="xforms-value-changed"> > <xf:insert ev:event="xforms-value-changed" > ref="$outer-binding" > origin="instance('admission-model')"/> > <xf:delete "old model" /> > </xf:action> > > </xf:select1> > > > -- > 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 -- 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 winmail.dat (14K) Download Attachment |
Daniel,
One way to deal with it is to delete the root node which your xbl is referencing and insert back to external instance. <xxforms:variable name="binding" as="node()?">
<xxforms:sequence select="." xxbl:scope="outer" /> </xxforms:variable> <xxforms:variable name="parent-binding" as="node()?"> <xxforms:sequence select=".." xxbl:scope="outer" />
</xxforms:variable> <xxforms:variable name="local-binding" as="node()?"> <xxforms:sequence select="instance()/@value" xxbl:scope="inner" />
</xxforms:variable> <!-- on value change populate back to outer instance --> <xforms:action ev:event="xforms-value-changed"> <xforms:delete nodeset="binding" />
<xforms:insert context="$parent-binding" origin="$local-binding" /> </xforms:action> If this doesn't work can you create a sample xhtml which we could run in a sandbox to see the real problem?
On Mon, Jul 18, 2011 at 8:18 AM, Daniel R. Klemm <[hidden email]> wrote: Tried that and it only seems to work for single node/value elements. We have a complex xml model and each xbl component is made up of many xform controls. I've search up and down the forum and internet for someone trying to do the same thing, I'm really surprised no one asked about this or experienced that same problems. -- 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 |
Free forum by Nabble | Edit this page |