How to check if the field is empty or not for visibility of other field?

8 views
Skip to first unread message

Neha Dhingra

unread,
May 22, 2020, 3:19:40 AM5/22/20
to Orbeon Forms
I have one field which holds attachment, if it is not empty, I want to enable and disable other field on this basis.

For example, it is not like that I am checking the dropdown value and comparing it, rather I just want to confirm the if my field as a value or not at runtime.


I could not find any Xpath expression or formula for this. 

Please help to understand the implementation of this scenario.

Thanks,
Neha

Jan Horký

unread,
May 22, 2020, 7:25:48 AM5/22/20
to orb...@googlegroups.com
Hi, you can use attribute relevant on xf:bind
e.g.: 
This part contains value that drives visibility of another xform part
              <xf:bind ref="stx_AB_stx_PeriodSelect" name="stx_AB_stx_PeriodSelect" xxf:whitespace="trim" id="stx_AB_stx_PeriodSelect-bind">
                <xf:required id="validation-56-validation" value="true()"/>
              </xf:bind>
...
Xform part, that should be hidden
              <xf:bind relevant="$stx_AB_stx_PeriodSelect='02'" ref="stx_EB_OpenPeriod" name="stx_EB_OpenPeriod" id="stx_EB_OpenPeriod-bind">
...

For element existence you can use xpath functions empty or exists.
Kind regards, Jan.

--
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 orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/b5ef94ba-c8bf-4b41-aaea-f3f4fea8fec0%40googlegroups.com.

Alessandro Vernet

unread,
May 25, 2020, 1:41:56 PM5/25/20
to orb...@googlegroups.com
Hi Neha,

And if you are using Form Builder, in the Control Settings for the field you
might want to disable, in the Formulas tab, for Visibility, you can enter an
expression as follows if you want the field to only be visible if no file is
uploaded to the field you named `my-file`.

xxf:is-blank($my-file)

I hope this helps,

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/
Reply all
Reply to author
Forward
0 new messages