problem with "linked" relevance

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

problem with "linked" relevance

Ramon de Beijer
Hi all,

I have a problem with a linked relevance....let me explain what i mean.

i have 3 input fields, control-1, control-2, control-3,
where control-2 becomes relevant when control-1 equals '1'
and control-3 becomes relevant when control-2 equals '2'

so now i enter '1' in the control-1 and controi-2 gets relevant/displayed
i enter '2' in control-2 and control-3 gets relevant/displayed.......so far so good
but now i change the value of control-1 to something else...control-2 becomes irrelevant but control-3 stays relevant

it looks like the value '2' stays in the model, making control-3 relevant
can i clear the control-2 node when it becomes irrelevant?
maybe with some sort of construction with

 <xforms:action ev:observer="fr-form-instance" ev:event="xxforms-value-changed">
    //loop all nodes in model, if irrelevant then clear
</xforms:action>

I could really use some help with this
it might be similar to this? http://orbeon-forms-ops-users.24843.n4.nabble.com/deleted-node-still-make-validation-fail-tp3553658p3587687.html


hereby the form xml

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xi="http://www.w3.org/2001/XInclude"
            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:exforms="http://www.exforms.org/exf/1-0"
            xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
            xmlns:saxon="http://saxon.sf.net/"
            xmlns:sql="http://orbeon.org/oxf/xml/sql"
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <xhtml:head>
        <xhtml:title>Untitled Form</xhtml:title>
        <xforms:model id="fr-form-model">

           
            <xforms:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-1/>
                        <control-2/>
                        <control-3/>
                    </section-1>
                </form>
            </xforms:instance>

           
            <xforms:bind id="fr-form-binds" nodeset="instance('fr-form-instance')">
                <xforms:bind id="section-1-bind" nodeset="section-1">
                    <xforms:bind id="control-1-bind" name="control-1" nodeset="control-1"/>
                    <xforms:bind id="control-2-bind" nodeset="control-2" name="control-2" type="xforms:string"
                                 relevant="$control-1='1'"/>
                    <xforms:bind id="control-3-bind" nodeset="control-3" name="control-3" type="xforms:string"
                                 relevant="$control-2='2'"/>
                </xforms:bind>
            </xforms:bind>

           
            <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
                <metadata>
                    <application-name>aaa</application-name>
                    <form-name>aaa</form-name>
                    <title xml:lang="en">Untitled Form</title>
                    <description xml:lang="en"/>
                    <author/>
                    <logo mediatype="" filename="" size=""/>
                </metadata>
            </xforms:instance>

           
            <xforms:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xforms:instance>

           
           
            <xforms:instance id="fr-form-resources" xxforms:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <section-1>
                            <label>Untitled Section</label>
                            <help/>
                        </section-1>
                        <control-1>
                            <label>control-1</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-1>
                        <control-2>
                            <label>control-2</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-2>
                        <control-3>
                            <label>control-3</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-3>
                    </resource>
                </resources>
            </xforms:instance>

           
            <xforms:instance id="fr-service-request-instance" xxforms:exclude-result-prefixes="#all">
                <request/>
            </xforms:instance>

            <xforms:instance id="fr-service-response-instance" xxforms:exclude-result-prefixes="#all">
                <response/>
            </xforms:instance>

        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <fr:view>
            <xforms:label ref="instance('fr-form-metadata')/title"/>
            <fr:body>
                <fr:section id="section-1-section" bind="section-1-bind">
                    <xforms:label ref="$form-resources/section-1/label"/>
                    <xforms:help ref="$form-resources/section-1/help"/>
                    <fr:grid columns="2">
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input id="control-1-control" bind="control-1-bind">
                                    <xforms:label ref="$form-resources/control-1/label"/>
                                    <xforms:hint ref="$form-resources/control-1/hint"/>
                                    <xforms:help ref="$form-resources/control-1/help"/>
                                    <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td>
                                <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                              xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                              xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-2-control"
                                              bind="control-2-bind">
                                    <xforms:label ref="$form-resources/control-2/label"/>
                                    <xforms:hint ref="$form-resources/control-2/hint"/>
                                    <xforms:help ref="$form-resources/control-2/help"/>
                                    <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                        </xhtml:tr>
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input xmlns:xbl="http://www.w3.org/ns/xbl"
                                              xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                              xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-3-control"
                                              bind="control-3-bind">
                                    <xforms:label ref="$form-resources/control-3/label"/>
                                    <xforms:hint ref="$form-resources/control-3/hint"/>
                                    <xforms:help ref="$form-resources/control-3/help"/>
                                    <xforms:alert ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td/>
                        </xhtml:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xhtml:body>
</xhtml:html>


Reply | Threaded
Open this post in threaded view
|

Re: problem with "linked" relevance

bsteuhl
Why not just clear out value in control 2 when control 1 does not equal 1?

So something like:

<xforms:input ref="control-1">
    <xforms:label>Control 1</xforms:label>
    <xforms:action ev:event="xforms-value changed"  xxforms:if="instance('controls')/control-1 != '1'">
     <xforms:setvalue ref="instance('controls')/control-1" value="''" />
    </xforms:action>
</xforms:input>

This would make control-3 irrelevant if control-1 was changed and not equal to '1' since control-2 value would be removed.
 

Brian Steuhl
Website: http://BTMSoftwareSolutions.com

Follow BTM on Twitter

Business Email: [hidden email]
Cell: 908-421-0742

Home Office: 732-961-3187

Google Voice: 732-800-1286 (1BTM)
RSS Feed To My Blog:

Business Process Modeling - BTMSoftwareSolutions.com




From: Ramon de Beijer <[hidden email]>
To: [hidden email]
Sent: Thu, June 16, 2011 9:22:46 AM
Subject: [ops-users] problem with "linked" relevance

Hi all,

I have a problem with a linked relevance....let me explain what i mean.

i have 3 input fields, control-1, control-2, control-3,
where control-2 becomes relevant when control-1 equals '1'
and control-3 becomes relevant when control-2 equals '2'

so now i enter '1' in the control-1 and controi-2 gets relevant/displayed
i enter '2' in control-2 and control-3 gets relevant/displayed.......so far
so good
but now i change the value of control-1 to something else...control-2
becomes irrelevant but control-3 stays relevant

it looks like the value '2' stays in the model, making control-3 relevant
can i clear the control-2 node when it becomes irrelevant?
maybe with some sort of construction with

<xforms:action ev:observer="fr-form-instance"
ev:event="xxforms-value-changed">
    //loop all nodes in model, if irrelevant then clear
</xforms:action>

I could really use some help with this
it might be similar to this?
http://orbeon-forms-ops-users.24843.n4.nabble.com/deleted-node-still-make-validation-fail-tp3553658p3587687.html


hereby the form xml

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xi="http://www.w3.org/2001/XInclude"
            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:exforms="http://www.exforms.org/exf/1-0"
            xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
            xmlns:saxon="http://saxon.sf.net/"
            xmlns:sql="http://orbeon.org/oxf/xml/sql"
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <xhtml:head>
        <xhtml:title>Untitled Form</xhtml:title>
        <xforms:model id="fr-form-model">

           
            <xforms:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-1/>
                        <control-2/>
                        <control-3/>
                    </section-1>
                </form>
            </xforms:instance>

           
            <xforms:bind id="fr-form-binds"
nodeset="instance('fr-form-instance')">
                <xforms:bind id="section-1-bind" nodeset="section-1">
                    <xforms:bind id="control-1-bind" name="control-1"
nodeset="control-1"/>
                    <xforms:bind id="control-2-bind" nodeset="control-2"
name="control-2" type="xforms:string"
                                relevant="$control-1='1'"/>
                    <xforms:bind id="control-3-bind" nodeset="control-3"
name="control-3" type="xforms:string"
                                relevant="$control-2='2'"/>
                </xforms:bind>
            </xforms:bind>

           
            <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
                <metadata>
                    <application-name>aaa</application-name>
                    <form-name>aaa</form-name>
                    <title xml:lang="en">Untitled Form</title>
                    <description xml:lang="en"/>
                    <author/>
                    <logo mediatype="" filename="" size=""/>
                </metadata>
            </xforms:instance>

           
            <xforms:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xforms:instance>

           
           
            <xforms:instance id="fr-form-resources"
xxforms:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <section-1>
                            <label>Untitled Section</label>
                            <help/>
                        </section-1>
                        <control-1>
                            <label>control-1</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-1>
                        <control-2>
                            <label>control-2</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-2>
                        <control-3>
                            <label>control-3</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-3>
                    </resource>
                </resources>
            </xforms:instance>

           
            <xforms:instance id="fr-service-request-instance"
xxforms:exclude-result-prefixes="#all">
                <request/>
            </xforms:instance>

            <xforms:instance id="fr-service-response-instance"
xxforms:exclude-result-prefixes="#all">
                <response/>
            </xforms:instance>

        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <fr:view>
            <xforms:label ref="instance('fr-form-metadata')/title"/>
            <fr:body>
                <fr:section id="section-1-section" bind="section-1-bind">
                    <xforms:label ref="$form-resources/section-1/label"/>
                    <xforms:help ref="$form-resources/section-1/help"/>
                    <fr:grid columns="2">
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input id="control-1-control"
bind="control-1-bind">
                                    <xforms:label
ref="$form-resources/control-1/label"/>
                                    <xforms:hint
ref="$form-resources/control-1/hint"/>
                                    <xforms:help
ref="$form-resources/control-1/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td>
                                <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"
                                           
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                           
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-2-control"
                                              bind="control-2-bind">
                                    <xforms:label
ref="$form-resources/control-2/label"/>
                                    <xforms:hint
ref="$form-resources/control-2/hint"/>
                                    <xforms:help
ref="$form-resources/control-2/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                        </xhtml:tr>
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"
                                           
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                           
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-3-control"
                                              bind="control-3-bind">
                                    <xforms:label
ref="$form-resources/control-3/label"/>
                                    <xforms:hint
ref="$form-resources/control-3/hint"/>
                                    <xforms:help
ref="$form-resources/control-3/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td/>
                        </xhtml:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xhtml:body>
</xhtml:html>




--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3602441.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
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

bsteuhl
Update - setvalue ref should have been set to control-2 not control-1.  Just caught my typo/error.
 

Brian Steuhl
Website: http://BTMSoftwareSolutions.com

Follow BTM on Twitter

Business Email: [hidden email]
Cell: 908-421-0742

Home Office: 732-961-3187

Google Voice: 732-800-1286 (1BTM)
RSS Feed To My Blog:

Business Process Modeling - BTMSoftwareSolutions.com




From: Brian Steuhl <[hidden email]>
To: [hidden email]
Sent: Thu, June 16, 2011 9:34:19 AM
Subject: [ops-users] Re: problem with "linked" relevance

Why not just clear out value in control 2 when control 1 does not equal 1?

So something like:

<xforms:input ref="control-1">
    <xforms:label>Control 1</xforms:label>
    <xforms:action ev:event="xforms-value changed"  xxforms:if="instance('controls')/control-1 != '1'">
     <xforms:setvalue ref="instance('controls')/control-1" value="''" />
    </xforms:action>
</xforms:input>

This would make control-3 irrelevant if control-1 was changed and not equal to '1' since control-2 value would be removed.
 

Brian Steuhl
Website:http://BTMSoftwareSolutions.com

Follow BTM on Twitter

Business Email: [hidden email]
Cell: 908-421-0742

Home Office: 732-961-3187

Google Voice: 732-800-1286 (1BTM)
RSS Feed To My Blog:

Business Process Modeling - BTMSoftwareSolutions.com




From: Ramon de Beijer <[hidden email]>
To: [hidden email]
Sent: Thu, June 16, 2011 9:22:46 AM
Subject: [ops-users] problem with "linked" relevance

Hi all,

I have a problem with a linked relevance....let me explain what i mean.

i have 3 input fields, control-1, control-2, control-3,
where control-2 becomes relevant when control-1 equals '1'
and control-3 becomes relevant when control-2 equals '2'

so now i enter '1' in the control-1 and controi-2 gets relevant/displayed
i enter '2' in control-2 and control-3 gets relevant/displayed.......so far
so good
but now i change the value of control-1 to something else...control-2
becomes irrelevant but control-3 stays relevant

it looks like the value '2' stays in the model, making control-3 relevant
can i clear the control-2 node when it becomes irrelevant?
maybe with some sort of construction with

<xforms:action ev:observer="fr-form-instance"
ev:event="xxforms-value-changed">
    //loop all nodes in model, if irrelevant then clear
</xforms:action>

I could really use some help with this
it might be similar to this?
http://orbeon-forms-ops-users.24843.n4.nabble.com/deleted-node-still-make-validation-fail-tp3553658p3587687.html


hereby the form xml

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xi="http://www.w3.org/2001/XInclude"
            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:exforms="http://www.exforms.org/exf/1-0"
            xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
            xmlns:saxon="http://saxon.sf.net/"
            xmlns:sql="http://orbeon.org/oxf/xml/sql"
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <xhtml:head>
        <xhtml:title>Untitled Form</xhtml:title>
        <xforms:model id="fr-form-model">

           
            <xforms:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-1/>
                        <control-2/>
                        <control-3/>
                    </section-1>
                </form>
            </xforms:instance>

           
            <xforms:bind id="fr-form-binds"
nodeset="instance('fr-form-instance')">
                <xforms:bind id="section-1-bind" nodeset="section-1">
                    <xforms:bind id="control-1-bind" name="control-1"
nodeset="control-1"/>
                    <xforms:bind id="control-2-bind" nodeset="control-2"
name="control-2" type="xforms:string"
                                relevant="$control-1='1'"/>
                    <xforms:bind id="control-3-bind" nodeset="control-3"
name="control-3" type="xforms:string"
                                relevant="$control-2='2'"/>
                </xforms:bind>
            </xforms:bind>

           
            <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
                <metadata>
                    <application-name>aaa</application-name>
                    <form-name>aaa</form-name>
                    <title xml:lang="en">Untitled Form</title>
                    <description xml:lang="en"/>
                    <author/>
                    <logo mediatype="" filename="" size=""/>
                </metadata>
            </xforms:instance>

           
            <xforms:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xforms:instance>

           
           
            <xforms:instance id="fr-form-resources"
xxforms:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <section-1>
                            <label>Untitled Section</label>
                            <help/>
                        </section-1>
                        <control-1>
                            <label>control-1</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-1>
                        <control-2>
                            <label>control-2</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-2>
                        <control-3>
                            <label>control-3</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-3>
                    </resource>
                </resources>
            </xforms:instance>

           
            <xforms:instance id="fr-service-request-instance"
xxforms:exclude-result-prefixes="#all">
                <request/>
            </xforms:instance>

            <xforms:instance id="fr-service-response-instance"
xxforms:exclude-result-prefixes="#all">
                <response/>
            </xforms:instance>

        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <fr:view>
            <xforms:label ref="instance('fr-form-metadata')/title"/>
            <fr:body>
                <fr:section id="section-1-section" bind="section-1-bind">
                    <xforms:label ref="$form-resources/section-1/label"/>
                    <xforms:help ref="$form-resources/section-1/help"/>
                    <fr:grid columns="2">
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input id="control-1-control"
bind="control-1-bind">
                                    <xforms:label
ref="$form-resources/control-1/label"/>
                                    <xforms:hint
ref="$form-resources/control-1/hint"/>
                                    <xforms:help
ref="$form-resources/control-1/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td>
                                <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"
                                           
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                           
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-2-control"
                                              bind="control-2-bind">
                                    <xforms:label
ref="$form-resources/control-2/label"/>
                                    <xforms:hint
ref="$form-resources/control-2/hint"/>
                                    <xforms:help
ref="$form-resources/control-2/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                        </xhtml:tr>
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"
                                           
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                           
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-3-control"
                                              bind="control-3-bind">
                                    <xforms:label
ref="$form-resources/control-3/label"/>
                                    <xforms:hint
ref="$form-resources/control-3/hint"/>
                                    <xforms:help
ref="$form-resources/control-3/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td/>
                        </xhtml:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xhtml:body>
</xhtml:html>




--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3602441.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
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Ramon de Beijer-2
In reply to this post by bsteuhl
hi Brian,

tnx for your idea, but the problem with this is that when I build the form like this I have to render loads of extra
action elements, obviously the real form is not 3 inputs big but over 100 controls and then this becomes a hell lot of work.

but maybe you or some one else out here...can help me out with a construction
that on the 'xxforms-value-changed' loops the model, and for every node checks its relevant
and if its irrelevant clears the value.

So can somebody help me out with looping over the model and checking the relevant of
every node, perhaps with the help of the function xxforms:evaluate-bind-property('name_of_the_node-bind', 'relevant')
the bindings are named the same as the nodes with the suffix '-bind'

<xforms:action ev:observer="fr-form-instance" ev:event="xxforms-value-changed">
    //loop all nodes in model, if irrelevant then clear
</xforms:action>

tnx again for your quick help now Brian, and maybe you can help me out with this one.....?

regards Ramon


On 06/16/2011 03:34 PM, Brian Steuhl wrote:
Why not just clear out value in control 2 when control 1 does not equal 1?

So something like:

<xforms:input ref="control-1">
    <xforms:label>Control 1</xforms:label>
    <xforms:action ev:event="xforms-value changed"  xxforms:if="instance('controls')/control-1 != '1'">
     <xforms:setvalue ref="instance('controls')/control-1" value="''" />
    </xforms:action>
</xforms:input>

This would make control-3 irrelevant if control-1 was changed and not equal to '1' since control-2 value would be removed.
 

Brian Steuhl
Website: http://BTMSoftwareSolutions.com

Follow BTM on Twitter

Business Email: [hidden email]
Cell: 908-421-0742

Home Office: 732-961-3187

Google Voice: 732-800-1286 (1BTM)
RSS Feed To My Blog:

Business Process Modeling - BTMSoftwareSolutions.com




From: Ramon de Beijer [hidden email]
To: [hidden email]
Sent: Thu, June 16, 2011 9:22:46 AM
Subject: [ops-users] problem with "linked" relevance

Hi all,

I have a problem with a linked relevance....let me explain what i mean.

i have 3 input fields, control-1, control-2, control-3,
where control-2 becomes relevant when control-1 equals '1'
and control-3 becomes relevant when control-2 equals '2'

so now i enter '1' in the control-1 and controi-2 gets relevant/displayed
i enter '2' in control-2 and control-3 gets relevant/displayed.......so far
so good
but now i change the value of control-1 to something else...control-2
becomes irrelevant but control-3 stays relevant

it looks like the value '2' stays in the model, making control-3 relevant
can i clear the control-2 node when it becomes irrelevant?
maybe with some sort of construction with

<xforms:action ev:observer="fr-form-instance"
ev:event="xxforms-value-changed">
    //loop all nodes in model, if irrelevant then clear
</xforms:action>

I could really use some help with this
it might be similar to this?
http://orbeon-forms-ops-users.24843.n4.nabble.com/deleted-node-still-make-validation-fail-tp3553658p3587687.html


hereby the form xml

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xi="http://www.w3.org/2001/XInclude"
            xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:exforms="http://www.exforms.org/exf/1-0"
            xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
            xmlns:saxon="http://saxon.sf.net/"
            xmlns:sql="http://orbeon.org/oxf/xml/sql"
            xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <xhtml:head>
        <xhtml:title>Untitled Form</xhtml:title>
        <xforms:model id="fr-form-model">

           
            <xforms:instance id="fr-form-instance">
                <form>
                    <section-1>
                        <control-1/>
                        <control-2/>
                        <control-3/>
                    </section-1>
                </form>
            </xforms:instance>

           
            <xforms:bind id="fr-form-binds"
nodeset="instance('fr-form-instance')">
                <xforms:bind id="section-1-bind" nodeset="section-1">
                    <xforms:bind id="control-1-bind" name="control-1"
nodeset="control-1"/>
                    <xforms:bind id="control-2-bind" nodeset="control-2"
name="control-2" type="xforms:string"
                                relevant="$control-1='1'"/>
                    <xforms:bind id="control-3-bind" nodeset="control-3"
name="control-3" type="xforms:string"
                                relevant="$control-2='2'"/>
                </xforms:bind>
            </xforms:bind>

           
            <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
                <metadata>
                    <application-name>aaa</application-name>
                    <form-name>aaa</form-name>
                    <title xml:lang="en">Untitled Form</title>
                    <description xml:lang="en"/>
                    <author/>
                    <logo mediatype="" filename="" size=""/>
                </metadata>
            </xforms:instance>

           
            <xforms:instance id="fr-form-attachments">
                <attachments>
                    <css mediatype="text/css" filename="" size=""/>
                    <pdf mediatype="application/pdf" filename="" size=""/>
                </attachments>
            </xforms:instance>

           
           
            <xforms:instance id="fr-form-resources"
xxforms:readonly="false">
                <resources>
                    <resource xml:lang="en">
                        <section-1>
                            <label>Untitled Section</label>
                            <help/>
                        </section-1>
                        <control-1>
                            <label>control-1</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-1>
                        <control-2>
                            <label>control-2</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-2>
                        <control-3>
                            <label>control-3</label>
                            <hint/>
                            <help/>
                            <alert/>
                        </control-3>
                    </resource>
                </resources>
            </xforms:instance>

           
            <xforms:instance id="fr-service-request-instance"
xxforms:exclude-result-prefixes="#all">
                <request/>
            </xforms:instance>

            <xforms:instance id="fr-service-response-instance"
xxforms:exclude-result-prefixes="#all">
                <response/>
            </xforms:instance>

        </xforms:model>
    </xhtml:head>
    <xhtml:body>
        <fr:view>
            <xforms:label ref="instance('fr-form-metadata')/title"/>
            <fr:body>
                <fr:section id="section-1-section" bind="section-1-bind">
                    <xforms:label ref="$form-resources/section-1/label"/>
                    <xforms:help ref="$form-resources/section-1/help"/>
                    <fr:grid columns="2">
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input id="control-1-control"
bind="control-1-bind">
                                    <xforms:label
ref="$form-resources/control-1/label"/>
                                    <xforms:hint
ref="$form-resources/control-1/hint"/>
                                    <xforms:help
ref="$form-resources/control-1/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td>
                                <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"
                                           
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                           
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-2-control"
                                              bind="control-2-bind">
                                    <xforms:label
ref="$form-resources/control-2/label"/>
                                    <xforms:hint
ref="$form-resources/control-2/hint"/>
                                    <xforms:help
ref="$form-resources/control-2/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                        </xhtml:tr>
                        <xhtml:tr>
                            <xhtml:td>
                                <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"
                                           
xmlns:fb="http://orbeon.org/oxf/xml/form-builder"
                                           
xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                              id="control-3-control"
                                              bind="control-3-bind">
                                    <xforms:label
ref="$form-resources/control-3/label"/>
                                    <xforms:hint
ref="$form-resources/control-3/hint"/>
                                    <xforms:help
ref="$form-resources/control-3/help"/>
                                    <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                                </xforms:input>
                            </xhtml:td>
                            <xhtml:td/>
                        </xhtml:tr>
                    </fr:grid>
                </fr:section>
            </fr:body>
        </fr:view>
    </xhtml:body>
</xhtml:html>




--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3602441.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
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Ramon de Beijer
Could somebody help me out with this one?
Perhaps Alex/Erik?

Cant imagine I am the only one with this issue

regards Ramon
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
Ramon,

Sorry about the delay. Is this still current? If so, I will try to
reproduce it ASAP.

-Erik

On Thu, Jul 14, 2011 at 10:06 PM, Ramon de Beijer
<[hidden email]> wrote:

> Could somebody help me out with this one?
> Perhaps Alex/Erik?
>
> Cant imagine I am the only one with this issue
>
> regards Ramon
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3669213.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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: problem with "linked" relevance

Ramon de Beijer-2
In reply to this post by Ramon de Beijer
Yep its still current so any help would be great

Erik Bruchez <[hidden email]> wrote:

>Ramon,
>
>Sorry about the delay. Is this still current? If so, I will try to
>reproduce it ASAP.
>
>-Erik
>
>On Thu, Jul 14, 2011 at 10:06 PM, Ramon de Beijer
><[hidden email]> wrote:
>> Could somebody help me out with this one?
>> Perhaps Alex/Erik?
>>
>> Cant imagine I am the only one with this issue
>>
>> regards Ramon
>>
>> --
>> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3669213.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


--
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: problem with "linked" relevance

Ramon de Beijer
Hi Erik,

Any luck with reproducing this?

regards Ramon
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
Ramon,

Not yet sorry! Like a few other issues reported recently there is a
bit of a backlog.

-Erik

On Thu, Aug 4, 2011 at 7:57 AM, Ramon de Beijer <[hidden email]> wrote:

> Hi Erik,
>
> Any luck with reproducing this?
>
> regards Ramon
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3718960.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
Reply | Threaded
Open this post in threaded view
|

Re: problem with "linked" relevance

Alessandro  Vernet
Administrator
In reply to this post by Ramon de Beijer
Hi Ramon,

This is a tricky one. Let's add one more control (#4), to push this one step further. Imagine you have control-1=1, control-2=2, control-3=3, so the 4 controls are visible. Now you clear control one. That makes control-2 non-relevant. This should clear the value of control-2, which will make control-3 non-relevant, which should clear the value of control-3, which should make control-4 non-relevant… and so on if you have more controls chained in that way. If you had to write this explicitly, you would do some kind of recursive or iterative algorithm.

The good thing is that this algorithm is already built into the XForms engine, and you were on a right track wanting to listen for some change event in the view. You could do better by listening to the xforms-disabled event. But this doesn't quite work with our latest code where now the section are XBL components. So even if you don't use that version yet, just to be future proof, you can use the technique below. Add this directly below the <fr:body>:

    <xxforms:variable name="nodes-relevance"
                      select="string-join(//*[empty(*)]/(if (exf:relevant(.)) then '1' else '0'), '')">
        <xforms:action ev:event="xforms-value-changed">
            <xforms:setvalue xxforms:iterate="//*[empty(*) and not(exf:relevant(.))]" ref="."/>
        </xforms:action>
    </xxforms:variable>

This is not super-declarative, but almost. Essentially, the above says in the view: if I'm becoming non-relevant, clear my value. It works because 

Alex

On Thu, Jun 16, 2011 at 6:22 AM, Ramon de Beijer <[hidden email]> wrote:
Hi all,

I have a problem with a linked relevance....let me explain what i mean.

i have 3 input fields, control-1, control-2, control-3,
where control-2 becomes relevant when control-1 equals '1'
and control-3 becomes relevant when control-2 equals '2'

so now i enter '1' in the control-1 and controi-2 gets relevant/displayed
i enter '2' in control-2 and control-3 gets relevant/displayed.......so far
so good
but now i change the value of control-1 to something else...control-2
becomes irrelevant but control-3 stays relevant

it looks like the value '2' stays in the model, making control-3 relevant
can i clear the control-2 node when it becomes irrelevant?
maybe with some sort of construction with

 <xforms:action ev:observer="fr-form-instance"
ev:event="xxforms-value-changed">
   //loop all nodes in model, if irrelevant then clear
</xforms:action>

I could really use some help with this
it might be similar to this?
http://orbeon-forms-ops-users.24843.n4.nabble.com/deleted-node-still-make-validation-fail-tp3553658p3587687.html


hereby the form xml

<xhtml:html xmlns:xhtml="http://www.w3.org/1999/xhtml"
           xmlns:xforms="http://www.w3.org/2002/xforms"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:ev="http://www.w3.org/2001/xml-events"
           xmlns:xi="http://www.w3.org/2001/XInclude"
           xmlns:xxi="http://orbeon.org/oxf/xml/xinclude"
           xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
           xmlns:exforms="http://www.exforms.org/exf/1-0"
           xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
           xmlns:saxon="http://saxon.sf.net/"
           xmlns:sql="http://orbeon.org/oxf/xml/sql"
           xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <xhtml:head>
       <xhtml:title>Untitled Form</xhtml:title>
       <xforms:model id="fr-form-model">


           <xforms:instance id="fr-form-instance">
               <form>
                   <section-1>
                       <control-1/>
                       <control-2/>
                       <control-3/>
                   </section-1>
               </form>
           </xforms:instance>


           <xforms:bind id="fr-form-binds"
nodeset="instance('fr-form-instance')">
               <xforms:bind id="section-1-bind" nodeset="section-1">
                   <xforms:bind id="control-1-bind" name="control-1"
nodeset="control-1"/>
                   <xforms:bind id="control-2-bind" nodeset="control-2"
name="control-2" type="xforms:string"
                                relevant="$control-1='1'"/>
                   <xforms:bind id="control-3-bind" nodeset="control-3"
name="control-3" type="xforms:string"
                                relevant="$control-2='2'"/>
               </xforms:bind>
           </xforms:bind>


           <xforms:instance id="fr-form-metadata" xxforms:readonly="true">
               <metadata>
                   <application-name>aaa</application-name>
                   <form-name>aaa</form-name>
                   <title xml:lang="en">Untitled Form</title>
                   <description xml:lang="en"/>
                   <author/>
                   <logo mediatype="" filename="" size=""/>
               </metadata>
           </xforms:instance>


           <xforms:instance id="fr-form-attachments">
               <attachments>
                   <css mediatype="text/css" filename="" size=""/>
                   <pdf mediatype="application/pdf" filename="" size=""/>
               </attachments>
           </xforms:instance>



           <xforms:instance id="fr-form-resources"
xxforms:readonly="false">
               <resources>
                   <resource xml:lang="en">
                       <section-1>
                           <label>Untitled Section</label>
                           <help/>
                       </section-1>
                       <control-1>
                           <label>control-1</label>
                           <hint/>
                           <help/>
                           <alert/>
                       </control-1>
                       <control-2>
                           <label>control-2</label>
                           <hint/>
                           <help/>
                           <alert/>
                       </control-2>
                       <control-3>
                           <label>control-3</label>
                           <hint/>
                           <help/>
                           <alert/>
                       </control-3>
                   </resource>
               </resources>
           </xforms:instance>


           <xforms:instance id="fr-service-request-instance"
xxforms:exclude-result-prefixes="#all">
               <request/>
           </xforms:instance>

           <xforms:instance id="fr-service-response-instance"
xxforms:exclude-result-prefixes="#all">
               <response/>
           </xforms:instance>

       </xforms:model>
   </xhtml:head>
   <xhtml:body>
       <fr:view>
           <xforms:label ref="instance('fr-form-metadata')/title"/>
           <fr:body>
               <fr:section id="section-1-section" bind="section-1-bind">
                   <xforms:label ref="$form-resources/section-1/label"/>
                   <xforms:help ref="$form-resources/section-1/help"/>
                   <fr:grid columns="2">
                       <xhtml:tr>
                           <xhtml:td>
                               <xforms:input id="control-1-control"
bind="control-1-bind">
                                   <xforms:label
ref="$form-resources/control-1/label"/>
                                   <xforms:hint
ref="$form-resources/control-1/hint"/>
                                   <xforms:help
ref="$form-resources/control-1/help"/>
                                   <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                               </xforms:input>
                           </xhtml:td>
                           <xhtml:td>
                               <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"

xmlns:fb="http://orbeon.org/oxf/xml/form-builder"

xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                             id="control-2-control"
                                             bind="control-2-bind">
                                   <xforms:label
ref="$form-resources/control-2/label"/>
                                   <xforms:hint
ref="$form-resources/control-2/hint"/>
                                   <xforms:help
ref="$form-resources/control-2/help"/>
                                   <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                               </xforms:input>
                           </xhtml:td>
                       </xhtml:tr>
                       <xhtml:tr>
                           <xhtml:td>
                               <xforms:input
xmlns:xbl="http://www.w3.org/ns/xbl"

xmlns:fb="http://orbeon.org/oxf/xml/form-builder"

xmlns:pipeline="java:org.orbeon.oxf.processor.pipeline.PipelineFunctionLibrary"
                                             id="control-3-control"
                                             bind="control-3-bind">
                                   <xforms:label
ref="$form-resources/control-3/label"/>
                                   <xforms:hint
ref="$form-resources/control-3/hint"/>
                                   <xforms:help
ref="$form-resources/control-3/help"/>
                                   <xforms:alert
ref="$fr-resources/detail/labels/alert"/>
                               </xforms:input>
                           </xhtml:td>
                           <xhtml:td/>
                       </xhtml:tr>
                   </fr:grid>
               </fr:section>
           </fr:body>
       </fr:view>
   </xhtml:body>
</xhtml:html>




--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3602441.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




--
Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/
My Twitter: http://twitter.com/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
Reply | Threaded
Open this post in threaded view
|

Re: problem with "linked" relevance

Ramon de Beijer
Hi Alex,

First developer testing looks promising,  hopefully the testers dont find anything as well.
I had to change exf: to eforms: but thats just because of the namespace def of course


     <xxforms:variable name="nodes-relevance" select="string-join(//*[empty(*)]/(if (exforms:relevant(.)) then '1' else '0'), '')">
        <xforms:action ev:event="xforms-value-changed">
            <xforms:setvalue xxforms:iterate="//*[empty(*) and not(exforms:relevant(.))]" ref="."/>
        </xforms:action>
    </xxforms:variable>



regards Ramon
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
Ramon,

Good to hear this.

-Erik

On Fri, Oct 28, 2011 at 5:54 AM, Ramon de Beijer
<[hidden email]> wrote:

> Hi Alex,
>
> First developer testing looks promising,  hopefully the testers dont find
> anything as well.
> I had to change exf: to eforms: but thats just because of the namespace def
> of course
>
>
>     <xxforms:variable name="nodes-relevance"
> select="string-join(//*[empty(*)]/(if (exforms:relevant(.)) then '1' else
> '0'), '')">
>        <xforms:action ev:event="xforms-value-changed">
>            <xforms:setvalue xxforms:iterate="//*[empty(*) and
> not(exforms:relevant(.))]" ref="."/>
>        </xforms:action>
>    </xxforms:variable>
>
>
>
> regards Ramon
>
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/problem-with-linked-relevance-tp3602441p3947793.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
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

chrisc
Hi Erik,

I am having the exact same issue with current orbeon version, we have forms with many linked visibility rules.

I modified the code that Ramon provided to try to make it work with the current version:

            <xf:var name="nodes-relevance"
                    select="string-join(//*[empty(*)]/(if (xxf:relevant(.)) then '1' else '0'), '')">
                <xf:action ev:event="xforms-value-changed">
                    <xf:setvalue xf:iterate="//*[empty(*) and not(xxf:relevant(.))]" ref="."/>
                </xf:action>
            </xf:var>

I added the code under this location:
<xh:head>
        <xh:title>My form title</xh:title>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">
but it is having no effect, i may have got it wrong though or put it in the wrong place.
Has this issue already been solved by another method the original posts are over 4 years old?

It would be better if a control deleted its own value when it became not relevant, rather than having to hack a solution together by adding code such as this.

Another way would be to check if a control is relevant as well as checking its value, but i could not get that to work.
I found this documentation:
http://doc.orbeon.com/xforms/xpath/extension-controls.html#xxfvalue
The docs say that xxf:value returns an empty sequence if the control is not relevant, so I tried using code like this inside the form builder visibility rule box: xxf:value('C1')//value = 'spc'  instead of the the simple version: $C1 = 'spc'     C1 is a dropdown btw.
I also tried using xxf:visited like this: xxf:visited('C1') and ($C1 = 'spc')

This is currently a show stopper for us.
I also want to avoid having to edit xforms xml to make our visibility rules work properly as we need non-developers to be able to create forms.

Thanks,
Chris
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
Chris,

> It would be better if a control deleted its own value when it became not relevant, rather than having to hack a solution together by adding code such as this.

I agree with this, and I entered an RFE with some further thoughts:

    https://github.com/orbeon/orbeon-forms/issues/2760

This said the following bit of code works for me:

   
    <xf:setvalue
        observer="fr-form-group"
        event="xforms-disabled"
        ref="event('xxf:binding')"/>

If you want this on all your forms, you should probably setup custom model logic instead:

    http://doc.orbeon.com/form-runner/advanced/custom-model-logic.html

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

chrisc
Thanks Eric, where in the form would i put that code and how does it work?
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
You can put it within the main <xf:model>, that is:

<xf:model id="fr-form-model" ...>
    ...
    your custom code here
</xf:model>

But again, I would try to avoid modifying the form source and use custom model logic instead:

    http://doc.orbeon.com/form-runner/advanced/custom-model-logic.html

> how does it work

Do you mean what does my XForms snippet do? It:

- listens for all xforms-disabled events at the level of fr-form-group (which is around the whole form)
- when receiving an event, it clears the value associated with the data binding of the source of the event, if any

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

chrisc
Hi Erik,

We are trying to get our heads around the custom model logic, in the meantime we will have to rely on the solution you provided.

However there is one issue with it, because it clears the control values when hidden/not-relevant we are unable to show and hide bits of static explaination text on the form as once the control is hidden the text is cleared so never re-appears.

I assumed that only editable controls could have a value property and so would have their value cleared, such as "Input Field" , "Text Area" , "Formatted Text", "Dropdown Menu" and Radio Buttons" etc.
It appears that the "Explanation" control is also cleared which doen't make sense as its not meant to be editable and so wouldn't have a value? (unless the value is the explanation text)

The only control that doesnt get cleared is the "Text Output" control, but we cant use this instead of the Explanation control as it does not allow line breaks.

How would we modify the code you provided to use an if statement that checks the type of control and only clears the value if it's not and "Explaination" control and if the control is not configured as read-only?
(we would not want to clear read-only controls that are hidden)

The behaviour regarding the value property is not consisent with what orbeon posts to our webservice when saving the form, the xml posted by orbeon contains values inside the xml elements for editable controls, but shows no value in the xml elements for "Explanation" controls as i would expect to be the case. However based on that behaviour it doesnt make sense for the "Explanation" control to actually have a value which is the non-editable text of the explanation?, if that was the case, which it looks like it is, i would expect that text to be sent in the xml element as the control's value if you see what i mean?

Thanks,
Chris


 
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
Chris,

I am not sure I understand why any of this is happening. The intent of the logic I provided is that *if* a control gets hidden (via a visibility formula), *then* its value will get cleared. That should be all.

So why would any of your Explanation controls get hidden? And why would it matter whether they have a value or not?

All controls, including Text Output and Explanation (now called Calculated Value and Explanatory Text in 2016.1), have an associated XML element. You can put a non-blank value in that XML element, but it won't do much.

Can you send a reproducible form showing exactly what is happening, alongside exact steps to reproduce the issue?

-Erik
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

chrisc
Hi Erik, basically what we are finding is that the code which clears the value of the controls also clears the text of any Explanation controls, so when they become relevant/visible again after being hidden/not-relevent the control is blank with no text.

I will create and send a simple form to demonstrate the issue.

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Re: problem with "linked" relevance

Erik Bruchez
Administrator
Great, I think a simple form will help. Looking forward to it! -Erik
12