relevant not using instance model type?

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

relevant not using instance model type?

bwallis42
I have a simple xform (extracted from a much larger one I'm converting from 3.9) that doesn't quite work as I expected.

I'm using the relevant attribute in a bind to turn on or off the display of a date field depending on the setting of a checkbox which is backed by a field of type boolean.

If I use "relevant='../discharged'" the visibility doesn't change, if I use "relevant='../discharged = true()'" then it does. Since the type in the bind for discharged is "xs:boolean" shouldn't the "= true()" be unnecessary?

<?xml version="1.1" encoding="UTF-8"?>
<xh:html xmlns:xh="http://www.w3.org/1999/xhtml"
         xmlns:fr="http://orbeon.org/oxf/xml/form-runner"
         xmlns:xf="http://www.w3.org/2002/xforms"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xxf="http://orbeon.org/oxf/xml/xforms"
         xmlns:xxi="http://orbeon.org/oxf/xml/xinclude">
   <xh:head>
        <xh:title>Untitled Form</xh:title>
        <xf:model id="fr-form-model" xxf:expose-xpath-types="true">
            <xf:instance>
                <xform>
                            <discharged>false</discharged>
                            <dischargedate/>
                </xform>
            </xf:instance>


            <xf:bind ref="discharged"
                  type="xs:boolean"/>
            <xf:bind ref="dischargedate"
                  type="xs:date"
                  relevant="../discharged = true()"/>

            <xf:instance xxf:readonly="true"
                          id="fr-form-metadata"
                          xxf:exclude-result-prefixes="#all">
                <metadata>
                   <application-name>CPF</application-name>
                   <form-name>Unknown</form-name>
                   <title xml:lang="en">Untitled Form</title>
                   <description xml:lang="en"/>
                </metadata>
             </xf:instance>
        </xf:model>

    </xh:head>
   <xh:body>
      <fr:view>
        <fr:body>
            <fr:section class="section">
                <xf:input ref="discharged" appearance="full">
                    <xf:label>Discharged</xf:label>
                </xf:input>
                <xf:input ref="dischargedate">
                    <xf:label>Discharge date</xf:label>
                </xf:input>
            </fr:section>
         </fr:body>
      </fr:view>
   </xh:body>
</xh:html>
Reply | Threaded
Open this post in threaded view
|

Re: relevant not using instance model type?

bwallis42
I forgot to mention that the form I'm converting from had

relevant="../discharged = 'true'"

which also does not work, as it always returns false.
Reply | Threaded
Open this post in threaded view
|

Re: relevant not using instance model type?

Alessandro  Vernet
Administrator
Hi Brian,

This is really tricky, and you're not the first one to fall into this "trap", so I've written some explanation about this in the documentation here:


However, I have to say that we're not very happy about this situation. As they say, if something looks wrong, it most likely is. (Or maybe it is something else they say!) Anyhow, I've created the following issue, and this is hopefully something we can take care of soon.


Alex

On Tuesday, February 9, 2016, bwallis42 <[hidden email]> wrote:
I forgot to mention that the form I'm converting from had

relevant="../discharged = 'true'"

which also does not work, as it always returns false.


--
View this message in context: http://discuss.orbeon.com/relevant-not-using-instance-model-type-tp4661022p4661023.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orbeon+unsubscribe@googlegroups.com&#39;)">orbeon+unsubscribe@....
To post to this group, send email to <a href="javascript:;" onclick="_e(event, &#39;cvml&#39;, &#39;orbeon@googlegroups.com&#39;)">orbeon@....

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: relevant not using instance model type?

bwallis42
Thanks Alex,
  I'm following the discussion. Sounds like a difficult one to resolve but once you know how it works then it is easy enough to work with. Bit of a trap for beginners though.
Reply | Threaded
Open this post in threaded view
|

Re: relevant not using instance model type?

Alessandro  Vernet
Administrator
Brian, I am glad this doesn't sound too crazy. We've done some more thinking, and have some ideas on how we could improve this, but we'll most likely let that simmer a bit before changing anything.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet