Is it possible to create an action that is triggered every time a control is changed to read only?
I want this action to be triggered by all control on my form. I want to take the triggered control and save it to a variable then I will set the value to null. How do I check that a control is read only when a control is changed? -Kevin |
Administrator
|
Kevin,
Yes, there are xforms-readonly/xforms-readwrite events on each control bound to a node. -Erik On Wed, Feb 22, 2012 at 11:38 AM, krowe <[hidden email]> wrote: > Is it possible to create an action that is triggered every time a control is > changed to read only? > > I want this action to be triggered by all control on my form. > > > I want to take the triggered control and save it to a variable then I will > set the value to null. > > > How do I check that a control is read only when a control is changed? > > -Kevin > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Does-an-OnReadOnly-event-exist-or-something-like-that-tp4411498p4411498.html > Sent from the Orbeon Forms (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 |
I am using Orbeon forms 3.8. Is it possible to have an action that is used by all controls when the xforms-readonly event is triggered. I have 100+ controls that change the xforms-readonly event.
So my perfect solution would be a single action that gets called by each control when an option changes the readonly status of a control, then that control has its value set to null to clear that field. <xforms:action ev:event="xforms-readonly"> <xxforms:variable name="ChangedControl-name" select="'ChangedControl'" as="xstring"/> <xforms:setvalue ref="instance('fr-form-instance')/*/*[name() = $ChangedControl-name]" value="null"/> </xforms:action> Is this the right way or what would be the better way to do what I want? How would I know what control triggered the readonly event? |
Administrator
|
Kevin,
I think event('xxforms:binding') will do exactly what you are looking for: it returns the single-node targeted by the event, in this case the xforms-readonly. So can just write: <xforms:setvalue ev:event="xforms-readonly" ref="event('xxforms:binding')"/> This is simpler and more robust, as this code won't depend on what the instance you're using looks like. You can find a short example that shows this in action at: https://gist.github.com/1921830
You'll let us know if this works for you, Alex > I am using Orbeon forms 3.8. Is it possible to have an action that is used by > all controls when the xforms-readonly event is triggered. I have 100+ > controls that change the xforms-readonly event. > > So my perfect solution would be a single action that gets called by each > control when an option changes the readonly status of a control, then that > control has its value set to null to clear that field. > > <xforms:action ev:event="xforms-readonly"> > <xxforms:variable name="ChangedControl-name" select="'ChangedControl'" > as="xstring"/> > <xforms:setvalue ref="instance('fr-form-instance')/*/*[name() = > $ChangedControl-name]" value="null"/> > </xforms:action> > > Is this the right way or what would be the better way to do what I want? > How would I know what control triggered the readonly event? > > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Does-an-OnReadOnly-event-exist-or-something-like-that-tp4411498p4413977.html > Sent from the Orbeon Forms (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 > -- Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet -- 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
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |